anujphp Posted January 2, 2009 Share Posted January 2, 2009 Hello i am displaying images from a paticular folder,the code is working fine but i want to display all the image in same width and height...the code for displaying images is givn below <?php // define absolute path to image folder $image_folder = 'IMAGE FOLDER NAME'; // get the image name from the query string if (isset($_GET['pic']) && basename($_GET['pic']) == $_GET['pic']) { $pic = $image_folder.$_GET['pic']; if (file_exists($pic) && is_readable($pic)) { // get the filename extension $ext = substr($pic, -3); // set the MIME type switch ($ext) { case 'jpg': $mime = 'image/jpeg'; break; case 'gif': $mime = 'image/gif'; break; case 'png': $mime = 'image/png'; break; default: $mime = false; } // if a valid MIME type exists, display the image // by sending appropriate headers and streaming the file if ($mime) { header('Content-type: '.$mime); header('Content-length: '.filesize($pic)); $file = @ fopen($pic, 'rb'); if ($file) { fpassthru($file); exit; } } } } ?> I am calling the php pages as below FILENAME.php?pic=$imgname THANK YOU IN ADVANCE.... Link to comment https://forums.phpfreaks.com/topic/139195-display-image-in-a-particular-width-and-height/ Share on other sites More sharing options...
flyhoney Posted January 2, 2009 Share Posted January 2, 2009 I think this should help: http://phpthumb.sourceforge.net/ Link to comment https://forums.phpfreaks.com/topic/139195-display-image-in-a-particular-width-and-height/#findComment-728143 Share on other sites More sharing options...
anujphp Posted January 4, 2009 Author Share Posted January 4, 2009 thanks for the link its a good one but i ont ned all those feature,i have written a code to resize a picture..but in my project i need to display a picture in different sizes.so i cant keep a picture in sifferent size Link to comment https://forums.phpfreaks.com/topic/139195-display-image-in-a-particular-width-and-height/#findComment-729275 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.