2010-02-23 7 views
0

jQuery 대화 상자에서 PHP로 만든 이미지를 표시하고 싶습니다.PHP 이미지 생성 및 jquery 대화 상자

나는이 모든 것을 얻으려고 할 때 이미지의 바이너리 데이터를 얻는다. 그러나 일반적인 PHP 페이지에서 이미지를 만드는 것은 문제가되지 않습니다.

내가 이미지를 대화의

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); 
} 

창조를 제작하는 간단한 PHP 스크립트를하는 것은 문제 및 출력 HTML이 아니다.

내 생성 된 이미지를 표시하려면 어떻게해야합니까?

누군가가 도움을 줄 수 있으면 좋겠습니까?

는 DOM에 당신에게

답변

1

로드 $ 아약스를 사용하여 이미지를() 감사 주입 :

$.load('#yourDialogContentDiv').html('<img src="http://YOUR_PHP_IMAGE_GENERATOR_SCRIPT" />')); 

그런 다음 당신의 jQuery 대화 상자를 보여줍니다. Presto!

+0

지금 나는 바보가된다 !!! 부탁해 주셔서 감사합니다. – Lee