Thumbnails not generating
| From: | Chris Blake | Date: | Mon, 14 Apr 2003 12:45:06 +0000 |
| Subject: | Thumbnails not generating | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-143754@lists.php.net to get a copy of this message | ||
Greetings learned PHP(eople),
Objective : Create thumbnail from single image
Code as follows :
----------------------------------------------
<html>
<head>
<title>Thumbnails</title>
</head>
<body>
<?php
function thumb_image()
{
$new_w=100;
$new_h=100;
header("Content-type: image/jpg");
$dst_img=ImageCreate($new_w,$new_h);
$src_img=ImageCreateFromJPEG("../graphics/stucco.jpg");
ImageCopyResized($dst_img,$src_img,0,0,0,0,$new_w,$new_h,ImageSX($src_img),ImageSY($src_img));
return (ImageJPEG($dst_img));
}
print '<table border="1">';
print '<tr>';
print '<td><img src="' . thumb_image() .
'"></img></td>';
print '</tr>';
print '</table>';
?>
</body>
</html>
---------------------------------------------------------------------------
Problem : Image not showing, output HTML looks like this :
---------------------------------
<html>
<head>
<title>Thumbnails</title>
</head>
<body>
<table border="1"><tr>
---------------------------------
I`ve used various examples from php.net online manual
(imagecreatefromjpg --png--gif, ,ImageCopyResized, ImageCreate et al) as
well as searching marc.theaimsgroup.com, and whilst they all look
similar, none of `em produce the required thumbnail.
Using PHP 4.23.
I`ve looked at functions to accomplish but being new to PHP I get hella
lost when reading through them (100`s of lines of code, some using MySQL
database). I got examples from www.seduction747.com but these are
copyright for commercial use.
Please advise if I`m missing some vital points on creating thumbnails.
-
Chris Blake
Office : (011) 782-0840
Cell : 083 985 0379
Linux vs. Windows is a no win situation.