Page 1 of 1

Hiccup during Image Upload/Processing

Posted: 2010-03-20T09:07:58-07:00
by conditionedBeard
Hello everyone,

Have an error message, which sometimes shows, sometimes it doesn't.
Would like to get some feedback please. :)

I am running a resize command, which sometimes produces an error.
The command is:

Code: Select all

convert ../testuser/live00001.jpg -resize 225x169 ../thumbs/tinylive.jpg
The two eMails that sometimes arrive with the error message are:
convert: Empty input file ` ../testuser/live00001.jpg' @ error/jpeg.c/EmitMessage/233.
convert: missing an image filename `../thumbs/tinylive.jpg' @ error/convert.c/ConvertImageCommand/2919.

AND

convert: Premature end of JPEG file `../testuser/live00001.jpg' @ warning/jpeg.c/EmitMessage/228.
convert: Corrupt JPEG data: premature end of data segment `../testuser/live00001.jpg' @ warning/jpeg.c/EmitMessage/228.
I believe these are occurring because the images are uploaded by "wireless modems".
These wireless modems have "scetchy" signals... thus the upload sometimes 'hangs' and stays mid-way.

Is there a way to set a parameter, to check if the images is being rewritten, or if it is 0kB, not to process?

Thoughts?
Thank you very much for the help!
Much appreciated :)

Let me know if you need more information!

-- HP
.

Re: Hiccup during Image Upload/Processing

Posted: 2010-03-20T10:06:20-07:00
by fmw42
see unix commands; search google for file tests, e.g

http://tldp.org/LDP/abs/html/fto.html
http://linuxreviews.org/beginner/bash_G ... Reference/

use such tests in an conditional with your convert so that if it fails, it does not do the convert

# test if image an ordinary, readable and non-zero size
if [ -f $infile -a -r $infile -a -s $infile ]; then
convert ...
else
echo "--- FILE $infile DOES NOT EXIST OR IS NOT AN ORDINARY FILE, NOT READABLE OR HAS ZERO SIZE ---"
exit 1
fi


OR

if convert -quiet -regard-warnings "$infile" ...
then
: ' do nothing '
else
echo "--- FILE $infile DOES NOT EXIST OR IS NOT AN ORDINARY FILE, NOT READABLE OR HAG ZERO SIZE ---"
fi

Re: Hiccup during Image Upload/Processing

Posted: 2010-06-14T21:00:21-07:00
by conditionedBeard
Hello fmw42,
It took me a while, yet I did the fix with your examples, and everything is working flawlessly.

Thank you very much for your help.
I didn't thank you when you posted.

Have a good one! :)

fmw42 wrote:see unix commands; search google for file tests, e.g

http://tldp.org/LDP/abs/html/fto.html
http://linuxreviews.org/beginner/bash_G ... Reference/

use such tests in an conditional with your convert so that if it fails, it does not do the convert

# test if image an ordinary, readable and non-zero size
if [ -f $infile -a -r $infile -a -s $infile ]; then
convert ...
else
echo "--- FILE $infile DOES NOT EXIST OR IS NOT AN ORDINARY FILE, NOT READABLE OR HAS ZERO SIZE ---"
exit 1
fi


OR

if convert -quiet -regard-warnings "$infile" ...
then
: ' do nothing '
else
echo "--- FILE $infile DOES NOT EXIST OR IS NOT AN ORDINARY FILE, NOT READABLE OR HAG ZERO SIZE ---"
fi