<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>CGarvey&#039;s Blog &#187; bug</title>
	<atom:link href="http://cgarvey.ie/blog/archive/tag/bug/feed/" rel="self" type="application/rss+xml" />
	<link>http://cgarvey.ie/blog</link>
	<description>The personal blog of Irish mobile and web application developer, Cathal Garvey</description>
	<lastBuildDate>Tue, 18 Oct 2011 04:14:45 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Running dotMobi WordPress Mobile Pack on PHP 4</title>
		<link>http://cgarvey.ie/blog/archive/2009/11/02/running-dotmobi-wordpress-mobile-pack-on-php-4/</link>
		<comments>http://cgarvey.ie/blog/archive/2009/11/02/running-dotmobi-wordpress-mobile-pack-on-php-4/#comments</comments>
		<pubDate>Mon, 02 Nov 2009 22:47:58 +0000</pubDate>
		<dc:creator>cgarvey</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[bug]]></category>
		<category><![CDATA[mobile]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://cgarvey.ie/blog/?p=331</guid>
		<description><![CDATA[If you, like me, are installing the dotMobi WordPress Mobile Pack on a server with PHP4 installed, and you enable the &#8220;Shrink images&#8221; feature under &#8220;Mobile Theme&#8221;, 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 [...]]]></description>
			<content:encoded><![CDATA[<p>If you, like me, are installing the <a href="http://wordpress.org/extend/plugins/wordpress-mobile-pack/" title="Link to the dotMobi WordPress Mobile Pack plugin page">dotMobi WordPress Mobile Pack</a> on a server with PHP4 installed, and you enable the &#8220;Shrink images&#8221; feature under &#8220;Mobile Theme&#8221;, you will likely see just the header of a blog post being out put for mobile devices (and not the full content).<br />
<span id="more-331"></span><br />
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 <code>file_put_contents(..)</code>, which fails without error, or logging, on my WordPress install.</p>
<p>To remedy the problem, I substituted the call, in 2 places, with the PHP4 equivalent calls. <code>file_put_contents(..)</code> is a shortcut convenience method which is the same as calling <code>fopen(..)</code>, <code>fwrite(..)</code> and <code>fclose(..)</code>.</p>
<p>As of version 1.1.3 of the plugin the code is under <code>wp-content/plugins/wordpress-mobile-pack/plugins/wpmp_transcoder/</code> in your WordPress install directory. The 2 occurrences are in the file <code>wpmp_transcoder.php</code> on lines 431 and 448 respectively.</p>
<p>I changed<br />
<code><br />
@file_put_contents($full_location, $data);<br />
</code><br />
.. to ..<br />
<code><br />
$fhout = @fopen($full_location, "w" );<br />
@fwrite($fhout, $data);<br />
@fclose( $fhout );<br />
</code></p>
<p>.. and ..</p>
<p><code><br />
@file_put_contents("$full_location.meta", "< ?php $"."width='$width';$"."height='$height';$"."type='$type'; ?>");<br />
</code><br />
.. to ..<br />
<code><br />
$fhmeta = @fopen( "$full_location.meta", "w" );<br />
@fwrite( $fhmeta, "< ?php $"."width='$width';$"."height='$height';$"."type='$type'; ?>");<br />
@fclose( $fhmeta );<br />
</code><br />
.. and all was well again.</p>
<p>You could also just not use the &#8220;Shrink images&#8221; feature to avoid having to mess with any code!</p>
]]></content:encoded>
			<wfw:commentRss>http://cgarvey.ie/blog/archive/2009/11/02/running-dotmobi-wordpress-mobile-pack-on-php-4/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

