Don't know if this helps, but the following works on my system.

Hugh

<?php
$picture="../photos/$userfile_name";
$size=getimagesize($picture);
$height=$size[1];
$width=$size[0];


$max=200;  // maximum dimension


if ($height>$width)
 {
 $nheight=$max;
 $nwidth=$width/($height/$max);
 }
else
 {
 $nwidth=$max;
 $nheight=$height/($width/$max);
 }

//header("content-type: image/jpeg");
$image=imagecreatefromjpeg($picture);
$image1=imagecreate($nwidth,$nheight);
imagecopyresized( $image1, $image,0,0, 0,0, $nwidth,
$nheight,$width,$height);


imagejpeg($image1,"../photos/sm_".$userfile_name."",100);

ImageDestroy($image);
ImageDestroy($image1);
?>
----- Original Message -----
From: "Phil Ewington" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, June 24, 2002 3:57 AM
Subject: [PHP] imagecopyresized() problems


> Hi,
>
> I am trying to copy and resize an image using imagecopyresized() and
> cannot seem to crack it. Below is the code I am using, can anyone tell
> me why I keep getting and invalid image resource warning and is this
> the src or dest parameter that the error is referring to?
>
> $srcImageName = "../properties/$line[propid].jpg";
> $destImageName = $rm_branchref . "_" . $line[propid] . ".jpg";
> $destImage = imagecreate(275, 183);
> imagecopyresized($destImage, $srcImageName, 0, 0, 0, 0, 275, 183,
> imagesx($srcImageName), imagesy($srcImageName));
> imageJpeg($destImage, $destImageName, 75);
> imagedestroy($destImage);
>
> All that happens is that I get an identical copy of the image, and not
> a resized one.
>
> TIA
>
> Phil Ewington.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>


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

Reply via email to