Image Upload Issues with Internet Explorer and image/pjpeg

Posted on February 24th, 2008 in Development | No Comments »

I’m working on a project that uses Zend_Gdata, specifically Zend_Gdata_Photos, to manage photos in Google’s Picasa Web Albums. When the application went into its testing phase, the image upload functionality began to throw exceptions. While I could upload photos to Picasa without issue, my business partner John couldn’t upload any photos at all. The application kept throwing the following error:

Error Message: Exception Message: Expected response code 200, got 400

Since the app worked fine for me, the issue didn’t seem to be with the code. After some frustrating, unproductive troubleshooting, I finally built a file upload mockup and ran the $_FILES array through Zend_Debug::dump(). I discovered that while Firefox reports the MIME type of a jpg as “image/jpeg”, Internet Explorer reports the MIME type as “image/pjpeg.” Thanks a lot, Redmond.

As it turned out, the problem occurred when I tried to set the upload content type to “image/pjpeg”:

$fd = $this->_service->newMediaFileSource($photo["tmp_name"]);
$fd->setContentType($photo["type"]);

I resolved the issue by adding a test for the pjpeg MIME type before setting the content type. The new code looks like this:

/** Resolves issue where IE changes jpg MIME type to image/pjpeg, breaking upload */
$photo["type"] = ($photo["type"] === "image/pjpeg") ? "image/jpeg" : $photo["type"];
$fd = $this->_service->newMediaFileSource($photo["tmp_name"]);
$fd->setContentType($photo["type"]);

The code snippets above come from an image upload helper method that I built (borrowing heavily from Cory Wiles) to make working with Zend_Gdata_Photos a little easier.

If you’re having similar problems uploading images, regardless of the method that you’re using, check that MIME type and see if that’s not the issue.

  • Share/Bookmark

IEs4Linux Blank Screen Bug and Installation Issues

Posted on February 16th, 2008 in Development, Linux | 1 Comment »

If you want / need to install Internet Explorer in Linux, I highly recommend IEs4Linux by Sérgio Lopes.

IEs4Linux is the simpler way to have Microsoft Internet Explorer running on Linux (or any OS running Wine).

I recently purchased a new Dell 1420n with Ubuntu 7.10 pre-installed. One of the first things I wanted to do was install all of my development tools, including IEs4Linux. What should have been an easy installation turned into a nightmare. I kept running into python errors that aborted the install. Once I finally got the application to install it was unusable. The IE toolbar was missing, including the address bar, the application would frequently crash, and I experienced maddening display bugs.

Apparently the blank screen bug has been a widespread issue. Sérgio has addressed it on his blog and pushed an emergency release of IEs4Linux, version 2.99.0.1, to resolve this issue only.

That’s all well and good, but I still had the python issues to deal with. What finally worked for me was to install IEs4Linux with the –no-gui flag, like so:

$ ./ies4linux --no-gui

For more information on installing IEs4Linux, including IE versions 5 and 5.5, visit the IEs4Linux installation page.

  • Share/Bookmark