<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: PHP ICO to PNG conversion</title>
	<atom:link href="http://www.tom-reitz.com/2009/02/17/php-ico-to-png-conversion/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.tom-reitz.com/2009/02/17/php-ico-to-png-conversion/</link>
	<description>Tech Talk, Catholic Commentary, and American Activism</description>
	<lastBuildDate>Mon, 30 Aug 2010 03:26:17 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Tony</title>
		<link>http://www.tom-reitz.com/2009/02/17/php-ico-to-png-conversion/comment-page-1/#comment-1448</link>
		<dc:creator>Tony</dc:creator>
		<pubDate>Wed, 28 Apr 2010 08:57:39 +0000</pubDate>
		<guid isPermaLink="false">http://www.tom-reitz.com/?p=119#comment-1448</guid>
		<description>wanna see something cool?

GetIconInfo($index);
	$icons[$index][&#039;width&#039;] = $icon[&#039;Width&#039;];
	$icons[$index][&#039;bitcount&#039;] = $icon[&#039;BitCount&#039;];
}
// sort by width, then bitcount (ascending). you can change the priority if you like by switching them around above
asort($icons);
// get the key of the last icon (highest quality) in the sorted list
$best = end(array_keys($icons));
// now make a png
if(!($png=$ico-&gt;GetIcon($best))) die(&quot;Could not load ICO.&quot;);
else {
	header(&quot;Content-Type: image/png&quot;);
	imagepng($png);
}
// win!
?&gt;

with a bit more effort, i use this to generate image preview tooltips in apache&#039;s autoindex [=</description>
		<content:encoded><![CDATA[<p>wanna see something cool?</p>
<p>GetIconInfo($index);<br />
	$icons[$index]['width'] = $icon['Width'];<br />
	$icons[$index]['bitcount'] = $icon['BitCount'];<br />
}<br />
// sort by width, then bitcount (ascending). you can change the priority if you like by switching them around above<br />
asort($icons);<br />
// get the key of the last icon (highest quality) in the sorted list<br />
$best = end(array_keys($icons));<br />
// now make a png<br />
if(!($png=$ico->GetIcon($best))) die(&#8220;Could not load ICO.&#8221;);<br />
else {<br />
	header(&#8220;Content-Type: image/png&#8221;);<br />
	imagepng($png);<br />
}<br />
// win!<br />
?></p>
<p>with a bit more effort, i use this to generate image preview tooltips in apache&#8217;s autoindex [=</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Vahan</title>
		<link>http://www.tom-reitz.com/2009/02/17/php-ico-to-png-conversion/comment-page-1/#comment-1123</link>
		<dc:creator>Vahan</dc:creator>
		<pubDate>Sun, 14 Feb 2010 06:29:49 +0000</pubDate>
		<guid isPermaLink="false">http://www.tom-reitz.com/?p=119#comment-1123</guid>
		<description>wordpress broke my loop! anyway it should be:
for($index = 0; $index LESSTHAN $ico-&gt;TotalIcons(); $index++){</description>
		<content:encoded><![CDATA[<p>wordpress broke my loop! anyway it should be:<br />
for($index = 0; $index LESSTHAN $ico->TotalIcons(); $index++){</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Vahan</title>
		<link>http://www.tom-reitz.com/2009/02/17/php-ico-to-png-conversion/comment-page-1/#comment-1122</link>
		<dc:creator>Vahan</dc:creator>
		<pubDate>Sun, 14 Feb 2010 06:25:47 +0000</pubDate>
		<guid isPermaLink="false">http://www.tom-reitz.com/?p=119#comment-1122</guid>
		<description>wanna see something cool?

&lt;?php
error_reporting(0);
require &#039;class.ico.php&#039;;
// load the .ico
$ico = new Ico(&#039;favicon.ico&#039;);
// now we&#039;re going to find the highest quality icon! first we need to know about each icon&#039;s image quality...
for($index = 0; $index TotalIcons(); $index++){
	$icon = $ico-&gt;GetIconInfo($index);
	$icons[$index][&#039;width&#039;] = $icon[&#039;Width&#039;];
	$icons[$index][&#039;bitcount&#039;] = $icon[&#039;BitCount&#039;];
}
// sort by width, then bitcount (ascending). you can change the priority if you like by switching them around above
asort($icons);
// get the key of the last icon (highest quality) in the sorted list
$best = end(array_keys($icons));
// now make a png
if(!($png=$ico-&gt;GetIcon($best))) die(&quot;Could not load ICO.&quot;);
else {
	header(&quot;Content-Type: image/png&quot;);
	imagepng($png);
}
// win!
?&gt;

with a bit more effort, i use this to generate image preview tooltips in apache&#039;s autoindex [=</description>
		<content:encoded><![CDATA[<p>wanna see something cool?</p>
<p>< ?php<br />
error_reporting(0);<br />
require 'class.ico.php';<br />
// load the .ico<br />
$ico = new Ico('favicon.ico');<br />
// now we're going to find the highest quality icon! first we need to know about each icon's image quality...<br />
for($index = 0; $index TotalIcons(); $index++){<br />
	$icon = $ico->GetIconInfo($index);<br />
	$icons[$index]['width'] = $icon['Width'];<br />
	$icons[$index]['bitcount'] = $icon['BitCount'];<br />
}<br />
// sort by width, then bitcount (ascending). you can change the priority if you like by switching them around above<br />
asort($icons);<br />
// get the key of the last icon (highest quality) in the sorted list<br />
$best = end(array_keys($icons));<br />
// now make a png<br />
if(!($png=$ico->GetIcon($best))) die(&#8220;Could not load ICO.&#8221;);<br />
else {<br />
	header(&#8220;Content-Type: image/png&#8221;);<br />
	imagepng($png);<br />
}<br />
// win!<br />
?></p>
<p>with a bit more effort, i use this to generate image preview tooltips in apache&#8217;s autoindex [=</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: KonstantinMiller</title>
		<link>http://www.tom-reitz.com/2009/02/17/php-ico-to-png-conversion/comment-page-1/#comment-286</link>
		<dc:creator>KonstantinMiller</dc:creator>
		<pubDate>Mon, 06 Jul 2009 22:32:19 +0000</pubDate>
		<guid isPermaLink="false">http://www.tom-reitz.com/?p=119#comment-286</guid>
		<description>I have been looking looking around for this kind of information. Will you post some more in future? I&#039;ll be grateful if you will.</description>
		<content:encoded><![CDATA[<p>I have been looking looking around for this kind of information. Will you post some more in future? I&#8217;ll be grateful if you will.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: CrisBetewsky</title>
		<link>http://www.tom-reitz.com/2009/02/17/php-ico-to-png-conversion/comment-page-1/#comment-285</link>
		<dc:creator>CrisBetewsky</dc:creator>
		<pubDate>Mon, 06 Jul 2009 20:29:12 +0000</pubDate>
		<guid isPermaLink="false">http://www.tom-reitz.com/?p=119#comment-285</guid>
		<description>I&#039;m glad that after surfing the web for uch a long time I have found out this information. I&#039;m really lucky.</description>
		<content:encoded><![CDATA[<p>I&#8217;m glad that after surfing the web for uch a long time I have found out this information. I&#8217;m really lucky.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: GarykPatton</title>
		<link>http://www.tom-reitz.com/2009/02/17/php-ico-to-png-conversion/comment-page-1/#comment-208</link>
		<dc:creator>GarykPatton</dc:creator>
		<pubDate>Tue, 16 Jun 2009 13:42:30 +0000</pubDate>
		<guid isPermaLink="false">http://www.tom-reitz.com/?p=119#comment-208</guid>
		<description>Hello, can you please post some more information on this topic? I would like to read more.</description>
		<content:encoded><![CDATA[<p>Hello, can you please post some more information on this topic? I would like to read more.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dp76</title>
		<link>http://www.tom-reitz.com/2009/02/17/php-ico-to-png-conversion/comment-page-1/#comment-159</link>
		<dc:creator>Dp76</dc:creator>
		<pubDate>Fri, 29 May 2009 15:57:09 +0000</pubDate>
		<guid isPermaLink="false">http://www.tom-reitz.com/?p=119#comment-159</guid>
		<description>Hello, First of all thanks for your work :)
But, please, update zip file as well. 
Your zip file have previous version without fixes.</description>
		<content:encoded><![CDATA[<p>Hello, First of all thanks for your work <img src='http://www.tom-reitz.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /><br />
But, please, update zip file as well.<br />
Your zip file have previous version without fixes.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: secret :)</title>
		<link>http://www.tom-reitz.com/2009/02/17/php-ico-to-png-conversion/comment-page-1/#comment-2</link>
		<dc:creator>secret :)</dc:creator>
		<pubDate>Wed, 11 Mar 2009 22:25:30 +0000</pubDate>
		<guid isPermaLink="false">http://www.tom-reitz.com/?p=119#comment-2</guid>
		<description>Great! keep the good work!

For the convenient of others, here&#039;s a quote from the first post:
------------
Here’s how you use the class:
    GetIcon(0))) die(&quot;Could not load ICO.&quot;);
    else {
              header(&quot;Content-Type: image/png&quot;);
              imagepng($r);
    }
    ?&gt;
------------

And I&#039;ve modified a bit your class, sometimes I just want to get the best quality icon (that&#039;s usually the last icon in the file) so I&#039;ve replaced this:
-----------
        function &amp;GetIcon($index) {
            if (!isset($this-&gt;formats[$index])) {
-----------
with this:
-----------
        function &amp;GetIcon($index=null) {
			if (is_null($index)) {
				$index = count($this-&gt;formats)-1;
			}
            if (!isset($this-&gt;formats[$index])) {
-----------
so I can omit the $index parameter and get the best icon (assuming he&#039;s the last one)

Good luck everyone!</description>
		<content:encoded><![CDATA[<p>Great! keep the good work!</p>
<p>For the convenient of others, here&#8217;s a quote from the first post:<br />
&#8212;&#8212;&#8212;&#8212;<br />
Here’s how you use the class:<br />
    GetIcon(0))) die(&#8220;Could not load ICO.&#8221;);<br />
    else {<br />
              header(&#8220;Content-Type: image/png&#8221;);<br />
              imagepng($r);<br />
    }<br />
    ?&gt;<br />
&#8212;&#8212;&#8212;&#8212;</p>
<p>And I&#8217;ve modified a bit your class, sometimes I just want to get the best quality icon (that&#8217;s usually the last icon in the file) so I&#8217;ve replaced this:<br />
&#8212;&#8212;&#8212;&#8211;<br />
        function &amp;GetIcon($index) {<br />
            if (!isset($this-&gt;formats[$index])) {<br />
&#8212;&#8212;&#8212;&#8211;<br />
with this:<br />
&#8212;&#8212;&#8212;&#8211;<br />
        function &amp;GetIcon($index=null) {<br />
			if (is_null($index)) {<br />
				$index = count($this-&gt;formats)-1;<br />
			}<br />
            if (!isset($this-&gt;formats[$index])) {<br />
&#8212;&#8212;&#8212;&#8211;<br />
so I can omit the $index parameter and get the best icon (assuming he&#8217;s the last one)</p>
<p>Good luck everyone!</p>
]]></content:encoded>
	</item>
</channel>
</rss>
