I have the following code which creates a thumbnail image from a larger picture.
All ok and working up to here
but I want to create a new file on the server
so I change the last part to what the tutorial says
I have tried a whole manner of options but the new file is not created.
I don't think it is a permission issue as the file is uploaded just before this script is run.
Could someone tell me what I am missing?
Keith
Code:
<?php
$img_name=$_GET['imnam'];
$new_lname=$_GET['nlnam'];
$new_sname=$_GET['nsnam'];
$max_width = 150; // maximum x aperture in pixels
$max_height = 150; // maximum y aperture in pixels
$size=GetImageSize($img_name);
$width_ratio = ($size[0] / $max_width);
$height_ratio = ($size[1] / $max_height);
if($width_ratio >=$height_ratio)
{
$ratio = $width_ratio;
}
else
{
$ratio = $height_ratio;
}
$new_width = ($size[0] / $ratio);
$new_height = ($size[1] / $ratio);
$src_img = ImageCreateFromJPEG($img_name);
$thumb = ImageCreateTrueColor($new_width,$new_height);
ImageCopyResampled($thumb, $src_img, 0,0,0,0,($new_width-1),($new_height-1),$size[0],$size[1]);
$textcolor = imagecolorallocate($thumb, 255, 0, 0);
$textcolor2 = imagecolorallocate($thumb, 0, 0, 0);
imagestring($thumb, 3, $new_width-$max_width, $new_height-30, "FUMNAIL FUMNAIL", $textcolor);
imagestring($thumb, 3, $new_width-$max_width, $new_height-120, "FUMNAIL FUMNAIL", $textcolor2);
ImageJPEG($thumb);
ImageDestroy($src_img);
ImageDestroy($thumb);
?>
All ok and working up to here
but I want to create a new file on the server
so I change the last part to what the tutorial says
Code:
ImageJPEG($thumb,[b]"newpic.jpg"[/b]);
ImageDestroy($src_img);
ImageDestroy($thumb);
?>
I don't think it is a permission issue as the file is uploaded just before this script is run.
Could someone tell me what I am missing?
Keith