bluebutterflyofyourmind Posted January 17, 2008 Share Posted January 17, 2008 Alrighty...here's the problem. I have images on a server and stored in a database and i'd like to display them as thumbnails in the browser. Every other time I've done this, I've saved thumbnail versions on the server. I find this a waste of space and would like to figure out how to display them dynamically without having to save individual versions. I get to the point of using imagejpeg() to output it to the browser but the browser can not decode what's going on. From my understanding i'm supposed to use "header("content-type: image/jpeg");" but i'm unclear as to where to put this because when i put it at the beginning before any output like it's supposed to be, all that displays is the url of the current page on a blank white page. any help? currently i have an index file which includes show.php. i have the header statement at the very beginning of the index.php this is the display code from show.php //make thumbnail of larger image list($width, $height, $type, $attr) = getimagesize($imagelink); //determine orientation of image if ($width >= $height) { $orientation = 0; } else { $orientation = 1; } $orig = imagecreatefromjpeg($imagelink); // Set a maximum height and width if ($orientation == 0) { $thumbheight = 72; $thumbwidth = 108; } else { $thumbheight = 97; $thumbwidth = 82; } //create memory for thumbnail $thumb = imagecreatetruecolor($thumbwidth,$thumbheight); $fg = imagecolorallocate($thumb,255,255,255); imagefilledrectangle($thumb,0,0,100,75,$fg); //copy large image to thumbnail imagecopyresampled($thumb,$orig,0,0,0,0,$thumbwidth,$thumbheight,$width,$height); //write thumb to browser imagejpeg($thumb); Link to comment https://forums.phpfreaks.com/topic/86495-some-major-image-display-issues/ Share on other sites More sharing options...
bluebutterflyofyourmind Posted January 17, 2008 Author Share Posted January 17, 2008 bump Link to comment https://forums.phpfreaks.com/topic/86495-some-major-image-display-issues/#findComment-442010 Share on other sites More sharing options...
bluebutterflyofyourmind Posted January 18, 2008 Author Share Posted January 18, 2008 *bump* again.. anyone? help? please? Link to comment https://forums.phpfreaks.com/topic/86495-some-major-image-display-issues/#findComment-442401 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.