I switched web hosts and some of the images in my galleries are broken, throwing strange error messages.
March 10, 2004 11:49 AM   Subscribe

Warning: Unexpected character in input: '' (ASCII=30) state=1

Any ideas? More inside (culprits are currently Photoshop, FTP, and my ignorance)..

I've switched web hosts and am trying to get my photo galleries up and running. I use batch automation in Photoshop 7 to perform a series of tasks (adjust brightness/color, resize, and export with appropriate settings). Then, I FTP all images to my webserver.

On some small percentage (less than 10%), I get this error when I try to view the image. The page calling the image will show a broken link and alt text, but no image. If I pull the image itself, I get this error:

Warning: Unexpected character in input: '' (ASCII=28) state=1 in /home/jasonmev/public_html/the/photolog/large/DSCN1738(2).jpg on line 130
Parse error: parse error in /home/jasonmev/public_html/the/photolog/large/DSCN1738(2).jpg on line 130

Any ideas? I'm transferring the images in binary, but past that, I'm lost.
posted by jmevius to Computers & Internet (12 answers total)
so you can view the image locally, but not from the website?

what if you ftp the image back again. is that local file now also unreadable?
posted by andrew cooke at 12:01 PM on March 10, 2004

Just a guess, but you may try not having brackets in the filename.
posted by armoured-ant at 12:13 PM on March 10, 2004

Could you give a link to an image doing this?
posted by smackfu at 12:14 PM on March 10, 2004

Especially since, I think, the ASCII number for ( is 28.
posted by armoured-ant at 12:16 PM on March 10, 2004

hot-damn. the ant thinks in hex!
posted by andrew cooke at 12:27 PM on March 10, 2004

It sounds as though some server-side scripting language (like PHP or perl) is trying to parse the .jpg file -- like it thinks the .jpg file contains ascii text which it is supposed to be interpreted as code.

The fix would depend entirely on what server software is running.
posted by mfbridges at 12:29 PM on March 10, 2004

Here's a better explanation, but the fix still depends on whether you have apache or IIS as your webserver:

I'm fairly certain it's PHP thing -- this google search brings up a lot of broken PHP pages.

So what's happening here is that the PHP engine is trying to parse all of your .jpg files before it sends output to the browser. It works most of the time because in PHP, unless the parser encounters this sequence of characters:


It just spits out the contents of the file, whether it's HTML or binary jpeg encoded garbage. If randomly in the .jpg file two adjacent bytes happen to have the same value as the ascii characters '<' and '?' then the PHP parser wil start trying to read some code. Since there is no code, the parser trips up and outputs the warning. Since you browser will try to display whatever the server spits back at it, it tries to display that warning as an image, which makes no sense, so it gives you a broken image.
posted by mfbridges at 12:46 PM on March 10, 2004

Response by poster: Here are a few example images:


The problem exists both on images that have the '('s and those that don't. The images also have different places where they show the error (for the examples above, it's 30, 23, & 17).

So, is this an .htaccess issue? One where my server should know to parse images as images?
posted by jmevius at 2:45 PM on March 10, 2004

Response by poster: Another followup, whenever I download one of the images to my local machine with an FTP program, it does display correctly.
posted by jmevius at 2:48 PM on March 10, 2004

If you're using Apache, then yes, this sounds like a .htaccess issue. Maybe adding something like
AddType image/jpeg .jpg
to your .htaccess file will help?
posted by kickingtheground at 3:33 PM on March 10, 2004

i think mfbridges has the probable explanation, so you need to tell php (or the server) to treat your image files differently from php source. hence the htaccess suggestion above, i guess.

i don't know anything about php, and couldn't find a solution with a quick google i'm afraid. however, it's pretty clearly some kind of server config problem, since the images are fine when you get them back to your machine.
posted by andrew cooke at 4:41 AM on March 11, 2004

Yes, what kickingtheground said. Also, you may want to do a search for ".jpg" in your httpd.conf and/or .htaccess for "jpg," just to make sure that there are no spurious "AddType" directives for jpeg's.
posted by mfbridges at 7:02 AM on March 11, 2004

« Older Is there a freeware utility that would list the...   |   How can I prevent FrontPage from adding random... Newer »
This thread is closed to new comments.