views:

132

answers:

1

library: http://wiki.github.com/masterexploder/PHPThumb/basic-usage

i am using the PhpThumbFactory library to crop and upload an image. the error im receiving is this:

Fatal error: Uncaught exception 'Exception' with message 'Image file not found: ' in /www/iaddesign/admin/classes/phpthumb/ThumbBase.inc.php:193 
Stack trace: 
#0 /www/iaddesign/admin/classes/phpthumb/ThumbBase.inc.php(172): ThumbBase->triggerError('Image file not ...') 
#1 /www/iaddesign/admin/classes/phpthumb/ThumbBase.inc.php(110): ThumbBase->fileExistsAndReadable() 
#2 /www/iaddesign/admin/classes/phpthumb/GdThumb.inc.php(96): ThumbBase->__construct('', false) 
#3 /www/iaddesign/admin/classes/phpthumb/ThumbLib.inc.php(127): GdThumb->__construct('', Array, false) 
#4 /www/iaddesign/admin/portfolio.php(29): PhpThumbFactory::create('') 
#5 {main} thrown in /www/iaddesign/admin/classes/phpthumb/ThumbBase.inc.php on line 193

here is the snippet that is for the image to be uploaded.

/* -------------------------------------------------------------------- */
/*                        SAVE ICONS                                    */
/* -------------------------------------------------------------------- */

$icononsrc = $_FILES['iconoff']['tmp_name'];
$iconoffsrc = $_FILES['iconon']['tmp_name'];

$thumboff = PhpThumbFactory::create($iconoffsrc);
$thumbon = PhpThumbFactory::create($icononsrc);

$thumboff->adaptiveResize(200,151);
$thumbon->adaptiveResize(200,151);

$thumboffname = "uploads/".$_FILES['iconoff']['name'];
$thumbonname = "uploads/".$_FILES['iconon']['name'];

$thumboff->save($thumboffname, 'jpg');
$thumbon->save($thumbonname, 'jpg');
A: 

From the stack trace, when checking if the file exists and is readable

#1 [cut] ThumbBase.inc.php(110): ThumbBase->fileExistsAndReadable() 

an error is thrown

#0 [cut] ThumbBase.inc.php(172): ThumbBase->triggerError('Image file not ...') 

(bear in mind the stack trace appears in reverse order)

I would infer from this that the file name you are trying to convert either doesn't exist, or has a permissions issue. Ensure that the file exists and has appropriate read permissions.

Andy
the file does exist i have a upload field <input type="file"...
michael
the errors say otherwise. Try verifying the contents of the file with `file_exists()` or echoing out the data to be sure.
Andy
Have you made any further progress with this?
Andy