problems with thumbnail image

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



hello,

I am a newbie trying to create on the fly thumbnail images on a debian sarge 
system with PHP Version 4.3.9-1.

The following code is used
<?
function thumbnail_img($photo_img_name)
{
        $percent = 0.5;
 list($width, $height) = getimagesize($photo_img_name);
 $newwidth = $width * $percent;
 $newheight = $height * $percent;
 $thumb = imagecreatetruecolor($newwidth, $newheight);
 $source = imagecreatefrompng($photo_img_name);
 imagecopyresized($thumb, $source, 0, 0, 0, 0, $newwidth, $newheight, $width, 
$height);
        return imagepng($thumb);
}

 print '<HTML>';
 print '<HEAD>';
 print '<META HTTP-EQUIV="Pragma" CONTENT="no-cache">';
 print '<TITLE>Image</TITLE>';
 print '</HEAD>';
        print '<body>';
        //image file name
 $photo_img_name='./photos/1.png';
        //display original image
 print '<IMG SRC='.$photo_img_name.' border=1>';
        //thumbnail image
        print '<IMG SRC='.thumbnail_img($photo_img_name).' border=1>';
        print '</body>';
        print '</html>';
?>

The original image gets displayed correctly. But in place of the thumbnail 
image i get loads of junk text data. I guess the hmtl tags are all in order 
as the original image is perfectly displayed.

What have i missed. Any comments, help etc will be appreciated.

regards
Punit Neb

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux