Forum Moderators: coopster

Message Too Old, No Replies

system returns 127

         

jackvull

10:57 am on Dec 25, 2006 (gmt 0)

10+ Year Member



Can't seem to get this code to work.
It returns 127 and uploads files succesfully but they are not resized by this script.
Any ideas or alternatives to try?

//-- RE-SIZING UPLOADED IMAGE

/*== only resize if the image is larger than 250 x 200 ==*/
$imgsize = GetImageSize($imgfile);

/*== check size 0=width, 1=height ==*/

echo $imgsize[0];echo " ";echo $imgsize[1];
if (($imgsize[0] > 250) ¦¦ ($imgsize[1] > 200))
{
/*== temp image file -- use "tempnam()" to generate the temp
file name. This is done so if multiple people access the
script at once they won't ruin each other's temp file ==*/
$tmpimg = tempnam("/tmp", "MKUP");

/*== RESIZE PROCESS
1. decompress jpeg image to pnm file (a raw image type)
2. scale pnm image
3. compress pnm file to jpeg image
==*/

/*== Step 1: djpeg decompresses jpeg to pnm ==*/
$last_line = system("djpeg $imgfile >$tmpimg", $retval);
echo $last_line." ".$retval." ";

/*== Steps 2&3: scale image using pnmscale and then
pipe into cjpeg to output jpeg file ==*/
$last_line = system("pnmscale -xy 250 200 $tmpimg ¦ cjpeg -smoo 10 -qual 50 >$imgfile", $retval);
echo $last_line." ".$retval." ";

/*== remove temp image ==*/
unlink($tmpimg);

}

coopster

3:42 pm on Dec 25, 2006 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



It returns 127

127 what?

Have you turned up error_reporting() [php.net] yet to see what, if any, error messages are being returned? How about checking the logs for any errors? I'm guessing it is likely some type of permissions issue for starters ...

jackvull

5:14 pm on Dec 26, 2006 (gmt 0)

10+ Year Member



Yeah, error reproting is turned on for this.
It's not a PHP error though. The 127 is the return code from the system command.
Probably UNIX.
Can't seem to work out why it's erroring though. I have safe mode turned off so the system command should work.

jackvull

5:22 pm on Dec 26, 2006 (gmt 0)

10+ Year Member



aha...

Warning: unlink(): SAFE MODE Restriction in effect. The script whose uid/gid is 2850/2850 is not allowed to access /tmp/MKUPC4fean owned by uid/gid 99/99 in /mounted-storage/home10/sub002/sc11883-LGVN/ssl/addpictures.php on line 104

Is this a GUID check?
I am uploading a file via the SSL on my site which moves the file to a folder on the unsecured WWW site.
They are essentially 2 different servers I think.

jackvull

5:26 pm on Dec 26, 2006 (gmt 0)

10+ Year Member



it doesn't make sense with the script above as the file is not moved until later in the script?

coopster

8:02 pm on Dec 26, 2006 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



on line 104

It is failing at the function on line 104.