php图像创建和jquery对话框
我希望能够在jQuery对话框窗口中显示使用php动态生成的图像 当我尝试这一切,我得到的是图像的二进制数据。但是在普通php页面上创建图像不是问题 我有一个简单的php脚本来创建图像php图像创建和jquery对话框,php,jquery,jquery-ui,modal-dialog,Php,Jquery,Jquery Ui,Modal Dialog,我希望能够在jQuery对话框窗口中显示使用php动态生成的图像 当我尝试这一切,我得到的是图像的二进制数据。但是在普通php页面上创建图像不是问题 我有一个简单的php脚本来创建图像 public function image() { header('Content-type: image/png'); // Create the image $im = imagecreatetruecolor(400, 400); // Create some colo
public function image()
{
header('Content-type: image/png');
// Create the image
$im = imagecreatetruecolor(400, 400);
// Create some colors
$white = imagecolorallocate($im, 255, 255, 255);
$grey = imagecolorallocate($im, 128, 128, 128);
$black = imagecolorallocate($im, 0, 0, 0);
imagefilledrectangle($im, 0, 0, 399, 399, $white);
// The text to draw
$text = 'Just some simple text...';
$font = 'arial.ttf';
// Add some shadow to the text
imagettftext($im, 20, 0, 10, 40, $grey, $font, $text);
// Add the text
imagettftext($im, 20, 0, 10, 20, $black, $font, $text);
// Using imagepng() results in clearer text compared with imagejpeg()
imagepng($im);
imagedestroy($im);
}
创建对话框并输出html不是问题
有没有关于如何让它显示我创建的图像的建议
真的希望有人能帮忙吗
谢谢使用$.ajax()加载图像并注入DOM:
$.load('#yourDialogContentDiv').html('<img src="http://YOUR_PHP_IMAGE_GENERATOR_SCRIPT" />'));
$.load('#yourDialogContentDiv').html('');
然后显示jQuery对话框。
普雷斯托