Hello,

I just enabled GD support for PHP via the php.ini file. When I try to
run a script that uses the functions included in the library, it gives
me a dialog box asking me whether I want to save the php file to a
specific location or not. I don't need to save it, I need PHP to run it.
This is happening on two machines enabled with the gd library. I'm using
PHP 4.0.6, while my remote host machine is using 4.1.1. Do I need a more
current version of the GD library to run this script? Here is the
script:

<?php

$image = "images/pic.jpg";

if (!$max_width)
   $max_width = 150;
if (!max_height)
   $max_height= 150;

$size = GetImageSize($image);
$width = $size[0];
$height = $size[1];

$x_ratio = $max_width / $width;
$y_ratio = $max_height / $height;

if (($width <= $max_width) && ($height <= $max_height)) {
   $tn_width = $width;
   $tn_height = $height;
}
elseif (($x_ratio * $height) < $max_height) {
   $tn_height = ceil($x_ratio * $height);
   $tn_width = $max_width;
}
else {
   $tn_width = ceil($y_ratio * $width);
   $tn_height = $max_height;
}

$src = ImageCreateFromJpeg ($image);
$dst = ImageCreate ($tn_width, $tn_height);
ImageCopyResized ($dst, $src, 0, 0, 0, 0, $tn_width, $tn_height, $width,
$height);
header ("Content-type: image/jpg");
ImageJpeg ($dst, null, -1);
ImageDestroy ($src);
ImageDestroy ($dst);

?>


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to