<?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: Dynamic Thumbnailing with Imagemagick in PHP</title> <atom:link href="http://sniptools.com/vault/dynamic-thumbnailing-with-imagemagick-in-php/feed" rel="self" type="application/rss+xml" /><link>http://sniptools.com/vault/dynamic-thumbnailing-with-imagemagick-in-php</link> <description>Design &#38; Technology Observations</description> <lastBuildDate>Wed, 09 May 2012 20:59:10 +0000</lastBuildDate> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.3.2</generator> <xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" /> <item><title>By: hermann</title><link>http://sniptools.com/vault/dynamic-thumbnailing-with-imagemagick-in-php#comment-2420</link> <dc:creator>hermann</dc:creator> <pubDate>Mon, 18 May 2009 13:55:12 +0000</pubDate> <guid
isPermaLink="false">http://sniptools.com/cms/?p=22#comment-2420</guid> <description>Works like a charm, but it&#039;s very slow.
Could it be improved?</description> <content:encoded><![CDATA[<p>Works like a charm, but it's very slow.<br
/> Could it be improved?</p> ]]></content:encoded> </item> <item><title>By: freestream</title><link>http://sniptools.com/vault/dynamic-thumbnailing-with-imagemagick-in-php#comment-774</link> <dc:creator>freestream</dc:creator> <pubDate>Thu, 05 Apr 2007 13:12:46 +0000</pubDate> <guid
isPermaLink="false">http://sniptools.com/cms/?p=22#comment-774</guid> <description>// Specify your file details
$current_file = &quot;P1010204.JPG&quot;;
$max_width = &quot;150&quot;;// Get the current info on the file
$current_size = getimagesize($current_file);
$current_img_width = $current_size[0];
$current_img_height = $current_size[1];
$image_base = explode(&quot;.&quot;, $current_file);// This part gets the new thumbnail name
$image_basename = $image_base[0];
$image_ext = $image_base[1];
$thumb_name = $image_basename.&quot;-th.&quot;.$image_ext;// Determine if the image actually needs to be resized
// and if it does, get the new height for it
if ($current_img_width &gt; $max_width)
{
$too_big_diff_ratio = $current_img_width/$max_width;
$new_img_width = $max_width;
$new_img_height = round($current_img_height/$too_big_diff_ratio);// Convert the file
$make_magick = system(&quot;convert -geometry &quot; . $new_img_width . &quot;x&quot; . $new_img_height . &quot; &quot; . $current_file . &quot; &quot; . $thumb_name, $retval);// Did it work?
if (!($retval))
{
echo &quot;Thumbnail created: &quot;;
}
else
{
echo &quot;Error: Please try again.&quot;;
}
}
else
{
echo &quot;No need to resize.&quot;;
} </description> <content:encoded><![CDATA[<p>// Specify your file details<br
/> $current_file = "P1010204.JPG";<br
/> $max_width = "150";</p><p>// Get the current info on the file<br
/> $current_size = getimagesize($current_file);<br
/> $current_img_width = $current_size[0];<br
/> $current_img_height = $current_size[1];<br
/> $image_base = explode(".", $current_file);</p><p>// This part gets the new thumbnail name<br
/> $image_basename = $image_base[0];<br
/> $image_ext = $image_base[1];<br
/> $thumb_name = $image_basename."-th.".$image_ext;</p><p>// Determine if the image actually needs to be resized<br
/> // and if it does, get the new height for it<br
/> if ($current_img_width &gt; $max_width)<br
/> {<br
/> $too_big_diff_ratio = $current_img_width/$max_width;<br
/> $new_img_width = $max_width;<br
/> $new_img_height = round($current_img_height/$too_big_diff_ratio);</p><p>// Convert the file<br
/> $make_magick = system("convert –geometry " . $new_img_width . "x" . $new_img_height . " " . $current_file . " " . $thumb_name, $retval);</p><p>// Did it work?<br
/> if (!($retval))<br
/> {<br
/> echo "Thumbnail created: ";<br
/> }<br
/> else<br
/> {<br
/> echo "Error: Please try again.";<br
/> }<br
/> }<br
/> else<br
/> {<br
/> echo "No need to resize.";<br
/> }</p> ]]></content:encoded> </item> <item><title>By: freestream</title><link>http://sniptools.com/vault/dynamic-thumbnailing-with-imagemagick-in-php#comment-773</link> <dc:creator>freestream</dc:creator> <pubDate>Thu, 05 Apr 2007 13:11:30 +0000</pubDate> <guid
isPermaLink="false">http://sniptools.com/cms/?p=22#comment-773</guid> <description>Well you can do it like that, but if you ever what it to work you might want to test this insted:</description> <content:encoded><![CDATA[<p>Well you can do it like that, but if you ever what it to work you might want to test this insted:</p> ]]></content:encoded> </item> <item><title>By: Kristin</title><link>http://sniptools.com/vault/dynamic-thumbnailing-with-imagemagick-in-php#comment-772</link> <dc:creator>Kristin</dc:creator> <pubDate>Tue, 28 Feb 2006 07:26:31 +0000</pubDate> <guid
isPermaLink="false">http://sniptools.com/cms/?p=22#comment-772</guid> <description>When I run the file... it gets all the way to &quot;Thumbnail Created&quot; but shows an x&#039;d out image... and when i check the directory the file isn&#039;t actually created... any ideas? </description> <content:encoded><![CDATA[<p>When I run the file… it gets all the way to "Thumbnail Created" but shows an x'd out image… and when i check the directory the file isn't actually created… any ideas?</p> ]]></content:encoded> </item> <item><title>By: Ahsan</title><link>http://sniptools.com/vault/dynamic-thumbnailing-with-imagemagick-in-php#comment-771</link> <dc:creator>Ahsan</dc:creator> <pubDate>Thu, 17 Nov 2005 02:03:13 +0000</pubDate> <guid
isPermaLink="false">http://sniptools.com/cms/?p=22#comment-771</guid> <description>I am using ur code on windows xp and it works fine if i put &quot;dir&quot; in the system command but when i write the convert command it doesn&#039;t do anything. I tried the command in cmd in the same folder and it works great but not when executed from the php file. Please tell were am i going wrong? </description> <content:encoded><![CDATA[<p>I am using ur code on windows xp and it works fine if i put "dir" in the system command but when i write the convert command it doesn't do anything. I tried the command in cmd in the same folder and it works great but not when executed from the php file. Please tell were am i going wrong?</p> ]]></content:encoded> </item> <item><title>By: Sasha</title><link>http://sniptools.com/vault/dynamic-thumbnailing-with-imagemagick-in-php#comment-770</link> <dc:creator>Sasha</dc:creator> <pubDate>Fri, 20 May 2005 22:59:01 +0000</pubDate> <guid
isPermaLink="false">http://sniptools.com/cms/?p=22#comment-770</guid> <description>Generated file is too big.Better to use -thumbnail like this:$make_magick = exec(&quot;convert -thumbnail $new_img_width x $new_img_height $current_file $thumb_name&quot;, $retval);</description> <content:encoded><![CDATA[<p>Generated file is too big.</p><p>Better to use –thumbnail like this:</p><p>$make_magick = exec("convert –thumbnail $new_img_width x $new_img_height $current_file $thumb_name", $retval);</p> ]]></content:encoded> </item> <item><title>By: namdev</title><link>http://sniptools.com/vault/dynamic-thumbnailing-with-imagemagick-in-php#comment-769</link> <dc:creator>namdev</dc:creator> <pubDate>Sun, 03 Apr 2005 03:41:19 +0000</pubDate> <guid
isPermaLink="false">http://sniptools.com/cms/?p=22#comment-769</guid> <description>It gives me errorWarning: getimagesize
No need to resizei think problem is with
// This part gets the new thumbnail name
$image_basename = $image_base[0];
$image_ext = $image_base[1];$thumb_name = $image_basename.&#039;-th.&#039;.$image_ext;</description> <content:encoded><![CDATA[<p>It gives me error</p><p>Warning: getimagesize<br
/> No need to resize</p><p>i think problem is with<br
/> // This part gets the new thumbnail name<br
/> $image_basename = $image_base[0];<br
/> $image_ext = $image_base[1];</p><p>$thumb_name = $image_basename.'-th.'.$image_ext;</p> ]]></content:encoded> </item> <item><title>By: Jason</title><link>http://sniptools.com/vault/dynamic-thumbnailing-with-imagemagick-in-php#comment-768</link> <dc:creator>Jason</dc:creator> <pubDate>Wed, 09 Mar 2005 21:13:06 +0000</pubDate> <guid
isPermaLink="false">http://sniptools.com/cms/?p=22#comment-768</guid> <description>this code does not work.instead of:&quot;system(&quot;convert -geometry $new_img_width x $new_img_height $current_file $thumb_name&quot;, $retval);&quot;it needs to be:&quot;exec(&quot;convert -geometry $new_img_width x $new_img_height $current_file $thumb_name&quot;, $retval);&quot; </description> <content:encoded><![CDATA[<p>this code does not work.</p><p>instead of:</p><p>"system("convert –geometry $new_img_width x $new_img_height $current_file $thumb_name", $retval);"</p><p>it needs to be:</p><p>"exec("convert –geometry $new_img_width x $new_img_height $current_file $thumb_name", $retval);"</p> ]]></content:encoded> </item> <item><title>By: nick</title><link>http://sniptools.com/vault/dynamic-thumbnailing-with-imagemagick-in-php#comment-767</link> <dc:creator>nick</dc:creator> <pubDate>Mon, 18 Oct 2004 23:11:01 +0000</pubDate> <guid
isPermaLink="false">http://sniptools.com/cms/?p=22#comment-767</guid> <description>That means you didn&#039;t have a file to open/convert </description> <content:encoded><![CDATA[<p>That means you didn't have a file to open/convert</p> ]]></content:encoded> </item> <item><title>By: Thumbnews</title><link>http://sniptools.com/vault/dynamic-thumbnailing-with-imagemagick-in-php#comment-766</link> <dc:creator>Thumbnews</dc:creator> <pubDate>Sat, 20 Mar 2004 16:38:45 +0000</pubDate> <guid
isPermaLink="false">http://sniptools.com/cms/?p=22#comment-766</guid> <description>I also get a division by zero error. Need help. </description> <content:encoded><![CDATA[<p>I also get a division by zero error. Need help.</p> ]]></content:encoded> </item> </channel> </rss>
<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk: basic
Page Caching using disk: enhanced (User agent is rejected)
Database Caching 6/8 queries in 0.003 seconds using disk: basic
Object Caching 579/579 objects using disk: basic

Served from: www.sniptools.com @ 2012-05-21 20:34:06 -->
