PDA

View Full Version : Thumbnail Creation Problems



Titan85
03-08-2008, 01:41 AM
I am trying to create a thumbnail image of an image being uploaded, but for some reason it fails to create the thumbnail but uploads the original image. Here is the code I am using:


$pic = $play_upload_path.$filename;
list($width, $height) = getimagesize($pic);
$filename1 = "thumb_".$filename;
$new_name = $play_upload_path.$filename1;
$newImage = $filename1;

$new_width = 50;
$new_height = 50;

$image_p = imagecreatetruecolor($new_width, $new_height);
$image = imagecreatefromjpeg($pic);
imagecopyresampled($image_p, $image, 0, 0, 0, 0, $new_width, $new_height, $width, $height);
imagejpeg($image_p, $new_name, 100);
$thumb = $play_upload_path.$filename1;


When I run the script, I get this error:

Warning: imagejpeg(): Unable to open '*site url*/select_effect/players/thumb_1990_iroc-z-side.jpg' for writing in *site url*/select_effect/cms/players.php on line 210

For some reason it can not open the thumbnail image file, but I do not know why it is opening instead of creating the image. Any ideas?

Thanks