What is a valid image resource for imagecopyresample()
Posted: Thu Apr 08, 2004 9:13 pm
First, let me paste the warning that I'm getting:
Warning: imagecopyresampled(): supplied argument is not a valid Image resource in /home/<mypath>/journal_submit.php on line 69
I'm trying to understand how to get an image on my filesystem to be used as a valid resource for imagecopyresample() so I can resize it. I haven't been able to get the image recognized as a resource. I read the documentation on php.net on resources, and it says that imagecreatefromjpeg() creates a valid resource that is used by imagecopyresample(), but it doesn't look like it's working for me. This is my first time trying these functions, so maybe I just don't get it.
I'm not an expert, but I do my homework and try to learn one function at a time. This one has stumped me.
Anyone have any ideas to help me? Thanks!
Warning: imagecopyresampled(): supplied argument is not a valid Image resource in /home/<mypath>/journal_submit.php on line 69
I'm trying to understand how to get an image on my filesystem to be used as a valid resource for imagecopyresample() so I can resize it. I haven't been able to get the image recognized as a resource. I read the documentation on php.net on resources, and it says that imagecreatefromjpeg() creates a valid resource that is used by imagecopyresample(), but it doesn't look like it's working for me. This is my first time trying these functions, so maybe I just don't get it.
I'm not an expert, but I do my homework and try to learn one function at a time. This one has stumped me.
Code: Select all
<?php
//some variables for my imagecopyresample()
//the server path to my existing image, which I just uploaded and moved here using a form and move_uploaded_file()
$img_src = $photos_path.$realphotoname;
//where I want to copy it and resize it to
$img_dest = $photos_path.$realphotoname.$thumbstring;
//Trying to make my image a resource that can be resampled
$img_resource = imagecreatefromjpeg($img_src);
//Just a test to see what gets returned. Maybe I don't understand resource.
echo $img_resource;
//That outputs: "Resource id #21"
//imagecopyresampled ( resource dst_im, resource src_im, int dstX, int dstY, int srcX, int srcY, int dstW, int dstH, int srcW, int srcH
imagecopyresampled($img_dest, $img_resource, 0, 0, 0, 0, 64, 48, 640, 480);// or die(mysql_error);
?>