>I have a directory of jpegs that I want to display thumbnails of and have a >link to the original jpeg. I would rather not create separate thumbnails >images preferring to create them in memory to display them. I have installed >GD v.1.8.4. The code below outputs jumbled text to the browser (possibly the >jpeg stream?).
If it starts with yayo, only with umlats over it, almost for sure, yeah, that's the JPEG data. There will be JPEG/JFIF in the text shortly after that. If you are getting that, you know you are "close" :-) >Code is as follows: > > </tr> > <td><img alt="text" src="<?php echo CreateThumbnail(); ?>" >valign="top" /></td> > </tr> You can't just smush the image into the SRC= The SRC= needs to be a URL, and that URL needs to spew out the image. In other words, that URL needs to "fake out" the browser into thinking it really is just a static image. <SRC=createThumbnail.php> Then just put all the stuff below into createThumbnail.php > ><?php >function CreateThumbnail() >{ > $x = 130; > $y = 100; > > $quality = 75; > > $thumbnail = imagecreate($x, $y); > $originalimage = imagecreatefromjpeg('test.jpg'); > > imagecopyresized($thumbnail, $originalimage, 0, 0, 0, 0, $x, $y, > ImageSX($originalimage),ImageSY($originalimage)); > > header("Content-Type: image/jpeg"); > imagejpeg($thumbnail,'test.jpg',$quality); > > imagedestroy($thumbnail); >} >?> -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php