If you, like me, are installing the dotMobi WordPress Mobile Pack on a server with PHP4 installed, and you enable the “Shrink images” feature under “Mobile Theme”, you will likely see just the header of a blog post being out put for mobile devices (and not the full content).
This feature reduces the image size (of any images in your WordPress post/page) to make it more bandwidth and screen friendly for mobile users. The problem is that it uses a PHP5-only call of file_put_contents(..)
, which fails without error, or logging, on my WordPress install.
To remedy the problem, I substituted the call, in 2 places, with the PHP4 equivalent calls. file_put_contents(..)
is a shortcut convenience method which is the same as calling fopen(..)
, fwrite(..)
and fclose(..)
.
As of version 1.1.3 of the plugin the code is under wp-content/plugins/wordpress-mobile-pack/plugins/wpmp_transcoder/
in your WordPress install directory. The 2 occurrences are in the file wpmp_transcoder.php
on lines 431 and 448 respectively.
I changed
@file_put_contents($full_location, $data);
.. to ..
$fhout = @fopen($full_location, "w" ); @fwrite($fhout, $data); @fclose( $fhout );
.. and ..
@file_put_contents("$full_location.meta", "< ?php $"."width='$width';$"."height='$height';$"."type='$type'; ?>");
.. to ..
$fhmeta = @fopen( "$full_location.meta", "w" ); @fwrite( $fhmeta, "< ?php $"."width='$width';$"."height='$height';$"."type='$type'; ?>"); @fclose( $fhmeta );
.. and all was well again.
You could also just not use the “Shrink images” feature to avoid having to mess with any code!
Leave a Reply