BioBob Posted June 4, 2009 Share Posted June 4, 2009 So I have a script that resizes images for thumbnails to a default size. But I also need to send a Content-Length header for the resized file size. getimagesize only works on files, not on recently generated stuff. How do I get the file size of the image to be sent to the browser? $img = imagecreatefromjpeg($file); $image_stats = getimagesize($file); //GDLib $image_width = $image_stats[0]; //width $image_height = $image_stats[1]; //height $size = 100; $new_h = $size; $ratio = ($image_height / $new_h); $new_w = round($image_width / $ratio); $dst_img = ImageCreateTrueColor($new_w,$new_h); imagecopyresampled ($dst_img,$img,0,0,0,0,$new_w,$new_h,$image_width,$image_height); imagejpeg($dst_img); imagedestroy($dst_img); imagedestroy($img); Link to comment https://forums.phpfreaks.com/topic/160892-need-a-content-length-header-for-a-dynamically-resized-image/ Share on other sites More sharing options...
BioBob Posted June 4, 2009 Author Share Posted June 4, 2009 Update: Is it possible to do this without writing the file to disk then using filesize() to get it? Link to comment https://forums.phpfreaks.com/topic/160892-need-a-content-length-header-for-a-dynamically-resized-image/#findComment-849089 Share on other sites More sharing options...
BioBob Posted June 4, 2009 Author Share Posted June 4, 2009 /bump. Anyone? Link to comment https://forums.phpfreaks.com/topic/160892-need-a-content-length-header-for-a-dynamically-resized-image/#findComment-849198 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.