Portal Home > Knowledgebase > Articles Database > Thumbnail help?? (PHP)
Thumbnail help?? (PHP)
Posted by WO Hostings, 02-06-2010, 12:04 PM |
I need some help from someone who knows what they are doing.
I am setting up my new website which is image hosting/sharing.
When uploading a picture to the website it then shows a thumbnail. However the thumbnail is showing a blank picture (black) and shows the following errors:
Warning: imagecopyresampled(): supplied argument is not a valid Image resource in /home/NAMEHIDDEN/public_html/process-upload.php on line 201
Warning: imagecopyresampled(): supplied argument is not a valid Image resource in /home/NAMEHIDDEN/public_html/process-upload.php on line 209
Warning: imagecopymerge(): supplied argument is not a valid Image resource in /home/NAMEHIDDEN/public_html/process-upload.php on line 219
Warning: imagejpeg(): supplied argument is not a valid Image resource in /home/NAMEHIDDEN/public_html/process-upload.php on line 225
If I go to the picture on my website, only the thumbnail shows a black picture. If I click on it to open it, the proper picture shows.
I'm confused?
I am willing to pay for some help if you can't help me.
This is the process-upload file
|
Posted by Driver01, 02-06-2010, 02:53 PM |
Are the images that you try to upload png.?
|
Posted by WO Hostings, 02-06-2010, 02:55 PM |
No i've tried different images..
|
Posted by Driver01, 02-06-2010, 03:11 PM |
Ok you need to run through and check things like what size the images are when you upload them, try uploading a small image file in size. Check the images open OK in a graphics program like photoshop. Check your php settings for upload_max_filesize, memory_limit and max_execution_time.
|
Posted by WO Hostings, 02-06-2010, 03:13 PM |
The thing is, the exact same images will upload using the album upload section - just not the normal upload..
|
Posted by Driver01, 02-06-2010, 04:40 PM |
Then check through the script and try echoing out $imgSrc to make sure the value is what you expect. Check after if thats OK the $img var. Sounds like its failing there somewhere.
|
Posted by Steve_Arm, 02-06-2010, 05:31 PM |
From reading it I see that the code is correct and it fails before the thumb creation here $img = imagecreatefromunknown($imgSrc);
Try to use absolute local path and let us know. I believe it will work.
|
Posted by WO Hostings, 02-06-2010, 05:34 PM |
What exactly is the absolute local path..
I have used:
home/username/public_html
|
Posted by Steve_Arm, 02-06-2010, 05:53 PM |
Yes after you moved the file it's location:
/home/username/public_html/pictures/".$fY."/".$fM."/".$fD."/".$rndName;
Notice the forwardslash at the beginning.
|
Posted by WO Hostings, 02-06-2010, 05:58 PM |
It already has the / before home.. still no good..
|
Posted by Driver01, 02-06-2010, 07:19 PM |
It has something do do with the paths imagecreatetruecolor will create a black image thumb to the dimensions you specify before resampling the src image as a thumb, obviously the src is failing for some reason. You know the image is OK and the mime type so it must be a path problem the script is not getting the true path to the src. ehco the scr path and see what it gives you. Try putting a forward slash here:
$uploadPath = "/pictures/".$fY."/".$fM."/".$fD."/".$rndName;
|
Posted by WO Hostings, 02-06-2010, 07:24 PM |
It has been sorted now. Hired linux-tech. You was along the right lines. It was imagecreatetruecolor causing the problem apparently. Thank you for your help guys.
|
Add to Favourites Print this Article
Also Read