WordPress Mobile Pack Broken Images

I have a WordPress site that uses the Mobile Pack plugin to display a friendly interface for mobile users. Installation went rather smooth, however I found that images weren’t displaying correctly. I could NOT figure out why for quite a while.

At first I thought it was an issue with LibGD not being installed on my IIS7 installation; that was not the case. Then I thought it was because IIS was trying to server the images using the wrong handler; that was not the case either.

Finally I discovered the problem… The Mobile Pack code.

The reason things were failing all boiled down to the fact that my wordpress site was a site in development and was running on a separate port (8080) during development. Aparently, the wpmp_transcoder (for shrinking images to fit mobile devices) code was not prepared to handle anything other than port 80.

The fix is: in the wpmp_transcoder_url_unparse($url) method, you must replace

$result .= $url[‘host’] . $url[‘path’];

with

$result .= $url['host'];
if ($url['port'] && $url[‘port’] != “80”) {
$result .= ':' . $url['port'];
}
$result .= $url['path'];

Leave a Reply

Your email address will not be published.

Humanity Verification *Captcha loading...