[Solved]- my php image resizing script crapped out on me
Posted: Fri May 13, 2005 3:41 pm
Well, after much trial and error, and lots of help in this forum, i got a gd script working for my site. Was working fine until very recently. i implemented a resizing script which i have here.
note i changed the $_get into a $_request to try to make it work, it didnt. the links work and eventually you get to a page which does not have a resize script and shows the file in its own popup window. That image does appear. So im stumped. here is a link to my site so you can see what i mean
http://www.treschicfurs.com/catalog/furcoat.php
if you click on an item, it will go to a different page with more details. At that point if you click on the image it will popup a window with the actual image not resized. Not sure what happened. Your help in this matter is always appreiciated.
Regards
-soia
Code: Select all
<?php
// The file
$filename = $_REQUEST['image'];;
$percent = .45;
// Content type
header('Content-type: image/jpeg');
// Get new dimensions
list($width, $height) = getimagesize($filename);
$new_width = $width * $percent;
$new_height = $height * $percent;
// Resample
$image_p = imagecreatetruecolor($new_width, $new_height);
$image = imagecreatefromjpeg($filename);
imagecopyresampled($image_p, $image, 0, 0, 0, 0, $new_width, $new_height, $width, $height);
// Output
imagejpeg($image_p, null, 50);
imagedestroy($image_p);
?>note i changed the $_get into a $_request to try to make it work, it didnt. the links work and eventually you get to a page which does not have a resize script and shows the file in its own popup window. That image does appear. So im stumped. here is a link to my site so you can see what i mean
http://www.treschicfurs.com/catalog/furcoat.php
if you click on an item, it will go to a different page with more details. At that point if you click on the image it will popup a window with the actual image not resized. Not sure what happened. Your help in this matter is always appreiciated.
Regards
-soia