<?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>Diadem Tech Weblogs &#187; PHP/MySQL</title>
	<atom:link href="http://www.diademblogs.com/category/phpmysql/feed" rel="self" type="application/rss+xml" />
	<link>http://www.diademblogs.com</link>
	<description>Tutorials, tips and howtos for web hosting and open source web development</description>
	<lastBuildDate>Mon, 17 Oct 2011 12:28:01 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=</generator>
		<item>
		<title>Integrating ICICI Payment Gateway in Linux with Plesk or Cpanel</title>
		<link>http://www.diademblogs.com/linux/icici-payment-gateway-integration</link>
		<comments>http://www.diademblogs.com/linux/icici-payment-gateway-integration#comments</comments>
		<pubDate>Thu, 05 May 2011 04:52:16 +0000</pubDate>
		<dc:creator>ankur</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[PHP/MySQL]]></category>
		<category><![CDATA[Plesk Control Panel]]></category>
		<category><![CDATA[ICICI PG in cPanel]]></category>
		<category><![CDATA[ICICI PG in Linux]]></category>
		<category><![CDATA[ICICI PG in Plesk]]></category>

		<guid isPermaLink="false">http://www.diademblogs.com/?p=1048</guid>
		<description><![CDATA[After multiple attempts we have finally being successful in integrating the ICICI Bank online payment gateway in our Linux severs with Plesk and cPanel. Below are the steps that may help you in configuring the same on your server. Configuration for PLesk 1. Download the SFA files from the ICICI merchant area and extract on [...]]]></description>
			<content:encoded><![CDATA[<p>After multiple attempts we have finally being successful in integrating the ICICI Bank online payment gateway in our Linux severs with Plesk and cPanel. Below are the steps that may help you in configuring the same on your server.</p>
<h3>Configuration for PLesk</h3>
<div id="_mcePaste"><strong>1.</strong> Download the SFA files from the ICICI merchant area and extract on the webserver under ICICI folder.</div>
<div>Extract the sfa.jar file in “SFA_Dependencies” and edit the sfa.properties file with the following entries:</div>
<blockquote>
<div id="_mcePaste">verbose=true</div>
<div id="_mcePaste">Key.Directory=/var/www/key</div>
<div id="_mcePaste">OS.Type=UNIX</div>
<div id="_mcePaste">traceLog=/var/log/tomcat5/icici.log</div>
</blockquote>
<div><strong>2. </strong>Copy the ICICI JAR files from “SFA_Dependencies” folder to the following folders</div>
<div>
<ul>
<li>JAR Files to copy: cryptix32.jar, jcert.jar, jnet.jar, jsse.jar, servlet.jar, sfa.jar</li>
<li>Copied jar files to  /usr/share/tomcat5/webapps/JavaBridge/WEB-INF/lib/ from /var/www/vhosts/domainname.com/httpdocs/ICICI/SFA_Dependencies [run this stape after installation of JavaBridge]</li>
<li>Reset permissions to these files to tomcat:tomcat under the lib folder</li>
<li>Also copy the jar files to /usr/share/tomcat5/common/lib folder</li>
<li>Change the owned and group of copied files as per the existing folder owner (Optional and ensure having 777 permissions on the above folder).</li>
</ul>
</div>
<div><strong>3.</strong> Download JavaBridge from below URL</div>
<div id="_mcePaste">
<ul>
<li># wget http://sourceforge.net/projects/php-java-bridge/files/Binary%20package/php-java-bridge_6.2.1/php-java-bridge_6.2.1_documentation.zip/download</li>
</ul>
</div>
<div id="_mcePaste">Install JavaBridge with the following steps:</div>
<div id="_mcePaste">
<ul>
<li>Unzip the php-java-bridge_6.1.2.1_documentation.zip</li>
<li># java -classpath JavaBridge.war TestInstallation</li>
<li># cp JavaBridge.war /var/lib/tomcat5/webapps/.</li>
<li># service tomcat5 restart</li>
<li>Test the installation at http://plesk02.diadem-tech.com:8080/JavaBridge</li>
</ul>
</div>
<div id="_mcePaste">Reference URLs:</div>
<div id="_mcePaste">
<ul>
<li>http://php-java-bridge.sourceforge.net/pjb/tomcat6.php</li>
<li>http://php-java-bridge.sourceforge.net/pjb/installation.php</li>
</ul>
</div>
<div><strong>4. </strong>Edit the file /var/lib/tomcat5/webapps/JavaBridge/WEB-INF/cgi/php.ini with below lines.</div>
<blockquote>
<div>;; -*- mode: Scheme; tab-width:4 -*-</div>
<div id="_mcePaste">;; A simple php.ini</div>
<div id="_mcePaste">;; extension_dir is this &#8220;cgi&#8221; directory</div>
<div id="_mcePaste">extension_dir=.</div>
<div id="_mcePaste">;; include php libraries from these directories</div>
<div id="_mcePaste">include_path=.:/usr/share/pear</div>
<div id="_mcePaste">java.classpath = /usr/share/tomcat5/webapps/JavaBridge/WEB-INF/lib/cryptix32.jar;/usr/share/tomcat5/webapps/JavaBridge/WEB-INF/lib/jcert.jar;/usr/share/tomcat5/webapps/JavaBridge/WEB-INF/lib/jnet.jar;/usr/share/tomcat5/webapps/JavaBridge/WEB-INF/lib/jsse.jar;/usr/share/tomcat5/webapps/JavaBridge/WEB-INF/lib/servlet.jar;/usr/share/tomcat5/webapps/JavaBridge/WEB-INF/lib/sfa.jar;</div>
</blockquote>
<div><strong>5. </strong>Edit /root/.bash_profile to set CLASSPATH as env variable and add the below lines.</div>
<blockquote>
<div id="_mcePaste">include_path=.:/usr/share/pear</div>
<div>CLASSPATH=$CLASSPATH:/usr/share/tomcat5/webapps/JavaBridge/WEB-INF/lib/cryptix32.jar;</div>
<div id="_mcePaste">CLASSPATH=$CLASSPATH:/usr/share/tomcat5/webapps/JavaBridge/WEB-INF/lib/jnet.jar;</div>
<div id="_mcePaste">CLASSPATH=$CLASSPATH:/usr/share/tomcat5/webapps/JavaBridge/WEB-INF/lib/servlet.jar;</div>
<div id="_mcePaste">CLASSPATH=$CLASSPATH:/usr/share/tomcat5/webapps/JavaBridge/WEB-INF/lib/sfa.jar;</div>
<div id="_mcePaste">CLASSPATH=$CLASSPATH:/usr/share/tomcat5/webapps/JavaBridge/WEB-INF/lib/jcert.jar;</div>
<div id="_mcePaste">CLASSPATH=$CLASSPATH:/usr/share/tomcat5/webapps/JavaBridge/WEB-INF/lib/jsse.jar;</div>
<div id="_mcePaste">export include_path</div>
<div id="_mcePaste">export CLASSPATH</div>
</blockquote>
<div>Run the following commands from shell:</div>
<div id="_mcePaste">
<ul>
<li>#. .bash_profile to set the environment variable.</li>
<li># env to check the environment variables.</li>
<li># service tomcat5 restart – Tomcat restart</li>
</ul>
</div>
<div><strong>6.</strong> Configure Tomcat to use SUN Java</div>
<div id="_mcePaste">
<ul>
<li># vim /etc/sysconfig/tomcat5</li>
</ul>
</div>
<div id="_mcePaste" style="padding-left: 30px;">Comment the existing JAVA_HOME and add the below line</div>
<div id="_mcePaste" style="padding-left: 30px;">JAVA_HOME=&#8221;/usr/java/jdk1.6.0_20/&#8221; (The JDK version will change as per the installed version)</div>
<div style="padding-left: 30px;">Restart Tomcat</div>
<div id="_mcePaste">
<ul>
<li># touch /var/log/tomcat5/icici.log</li>
<li># chown tomcat.tomcat /var/log/tomcat5/icici.log</li>
</ul>
</div>
<div id="_mcePaste"><strong>7. </strong>Stop Apache and Tomcat and then copy the following key files to the /var/www/key directory:</div>
<div id="_mcePaste">
<ul>
<li>0000XXXX.key</li>
<li>intermediate.cer</li>
<li> payseal.icicibank-chain-bundle.cer</li>
</ul>
</div>
<div id="_mcePaste" style="padding-left: 30px;">The .cer files can be found under the cert_bundle folder provided by ICICI. The key file also needs to be downloaded from the merchant admin site or provided by ICICI.</div>
<div id="_mcePaste">
<ul>
<li>Start Apache and Tomcat.</li>
</ul>
</div>
<div style="padding-left: 30px;">Run the following keyrestore command from the /var/www/key folder:</div>
<blockquote>
<div id="_mcePaste"># keytool -import -alias pgIntermediateCA -file ./intermediate.cer -keystore /usr/java/jdk1.6.0_12/jre/lib/security/cacerts -storepass changeit</div>
<div id="_mcePaste">This might give an error like keytool error: gnu.javax.crypto.keyring.MalformedKeyringException: incorrect magic which can be ignored.</div>
</blockquote>
<div><strong>8. </strong>Update the TestSSL.php page and change the response URL and use the updated file:</div>
<blockquote>
<div id="_mcePaste">$oMerchant-&gt;setMerchantDetails(&#8220;0000XXXX&#8221;,&#8221;0000XXXX&#8221;,&#8221;0000XXXX&#8221;,&#8221;193.545.34.33&#8243;,rand().&#8221;",&#8221;Ord123&#8243;,&#8221;http://10.10.10.147:8756/SFAResponse.php&#8221;,&#8221;POST&#8221;,&#8221;INR&#8221;,&#8221;INV123&#8243;,&#8221;req.Preauthorization&#8221;,&#8221;100&#8243;,&#8221;",&#8221;Ext1&#8243;,&#8221;true&#8221;,&#8221;Ext3&#8243;,&#8221;Ext4&#8243;,&#8221;Ext5&#8243;);</div>
<div id="_mcePaste">Also in SFAResponse.php and “./Sfa/PostLibPHP.php” file on line 2 would also change from</div>
<div id="_mcePaste">&#8216; require_once(&#8220;java/Java.php&#8221;);&#8217; to &#8216; require_once(&#8220;java/Java.inc&#8221;);&#8217;</div>
</blockquote>
<div id="_mcePaste">Test the TestSSL and Testjava pages</div>
<div id="_mcePaste">
<ul>
<li>http://domainname.com/ICICI/SFAClient/TestPages/testjava.php</li>
<li>http://domainname.com/ICICI/SFAClient/TestPages/TestSsl.php</li>
</ul>
</div>
<div id="_mcePaste">Hopefully the above links would work and the error output log can be checked at:</div>
<div id="_mcePaste">
<ul>
<li># tail –v –f /var/www/vhosts/pgtest.domainname.com/statistics/logs/error.log</li>
</ul>
<h3>cPanel configuration</h3>
<div>
<div>For cPanel you need to install Tomcat and FastCGI module in PHP to run ICICI PG, below are the steps.</div>
<div><strong>1.</strong> Login WHM with root user</div>
<div><strong>2.</strong> In the Main page  click on Software and then EasyApache (Apache Update)</div>
<div><strong>3. </strong>Go through each step as follows.</div>
<div style="padding-left: 30px;">a)	Click “Start customizing based on profile”</div>
<div style="padding-left: 30px;">b)	Select Apache Version – Click Next to proceed with the current version.</div>
<div style="padding-left: 30px;">c)	Select PHP Major Version – Click Next to proceed with the current version.</div>
<div style="padding-left: 30px;">d)	Select PHP Minor version – Click Next to proceed with the current version.</div>
<div style="padding-left: 30px;">e)	Short option list – Click “Exhaustive Options List” to view full options.</div>
<div style="padding-left: 30px;">Exhaustive Options List – From here you can select the PHP modules you needed</div>
<div style="padding-left: 30px;">Select mod_fcgid (FCGI module for Apache), FCGI and Tomcat (you can also select other PHP module for future requirement e.g. GD, SOAP, curl, Zend, Zlib, Zip bizip, MySQLi )</div>
<div style="padding-left: 30px;">f)	Click “Save &amp; Build” to start apache-php compilation.</div>
<div><strong>4. </strong>Once the compilation over you can verify the installed PHP modules using the following command.</div>
<blockquote>
<div># php –m</div>
</blockquote>
<div>And Tomcat from the URL: <strong>http://server ip:8080</strong></div>
<div><strong>5. </strong>After the installation of Tomcat defines the following important environment variables in /root/.bash_profile</div>
<blockquote>
<div>CATALINA_HOME=/usr/local/jakarta/tomcat</div>
<div>CATALINA_BASE=/usr/local/jakarta/tomcat</div>
<div>JAVA_HOME=/usr/local/jdk/</div>
<div>export CATALINA_HOME CATALINA_BASE JAVA_HOME</div>
</blockquote>
<div>Now run “#. .bash_profile” command from shell to set the environment variable.</div>
<div>All done now start the ICICI Payment Gateway Integration same as Plesk steps. Only the tomcat path is different i.e.<strong> /usr/local/jakarta/tomcat</strong>.</div>
</div>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.diademblogs.com/linux/icici-payment-gateway-integration/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Tips to optimise MySQL server performance</title>
		<link>http://www.diademblogs.com/database/tips-to-optimise-mysql-server-performance</link>
		<comments>http://www.diademblogs.com/database/tips-to-optimise-mysql-server-performance#comments</comments>
		<pubDate>Tue, 11 Jan 2011 06:10:43 +0000</pubDate>
		<dc:creator>hriday</dc:creator>
				<category><![CDATA[Database]]></category>
		<category><![CDATA[PHP/MySQL]]></category>

		<guid isPermaLink="false">http://www.diademblogs.com/?p=1037</guid>
		<description><![CDATA[Here are a couple of tweaks which can improve your mysql server performance significantly. We implemented this on our hosted servers and the php/mysql queries for dynamic DB driven applications  improved by over 50%. The following are the relevant commands which can be inserted in the mysql conf file, which is normally located at /etc/my.cnf. [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.diademblogs.com/wp-content/uploads/2011/01/optimise-mysql-performance.png"><img class="size-full wp-image-1042 alignright" style="margin: 5px;" title="optimise mysql performance" src="http://www.diademblogs.com/wp-content/uploads/2011/01/optimise-mysql-performance.png" alt="" width="170" height="115" /></a>Here are a couple of tweaks which can improve your mysql server performance significantly. We implemented this on our hosted servers and the php/mysql queries for dynamic DB driven applications <strong> improved by over 50%</strong>. The following are the relevant commands which can be inserted in the mysql conf file, which is normally located at <strong>/etc/my.cnf</strong>.</p>
<p><strong># Improves mysql server performance by disabling name resolution and remote mysql connections<br />
skip-name-resolve<br />
skip-networking</strong></p>
<p>The <strong>skip-name-resolve</strong> option will disable name resolution for hostnames and the <strong>skip-networking</strong> option would disable remote connections to be made to the local MySQL server. This is a recommended setting and would improve your server security as well.</p>
<p>Feel free to post your queries and share any other optimisation tips as well!</p>
Note: There is a rating embedded within this post, please visit this post to rate it.
]]></content:encoded>
			<wfw:commentRss>http://www.diademblogs.com/database/tips-to-optimise-mysql-server-performance/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Setting up and getting DOMpdf to work in XAMPP on Windows</title>
		<link>http://www.diademblogs.com/phpmysql/setting-up-and-getting-dompdf-to-work-in-xampp-on-windows</link>
		<comments>http://www.diademblogs.com/phpmysql/setting-up-and-getting-dompdf-to-work-in-xampp-on-windows#comments</comments>
		<pubDate>Mon, 23 Nov 2009 12:14:30 +0000</pubDate>
		<dc:creator>amitabh</dc:creator>
				<category><![CDATA[PHP/MySQL]]></category>

		<guid isPermaLink="false">http://www.diademblogs.com/?p=423</guid>
		<description><![CDATA[Setting up the Dompdf (a pdf generation package in php) in XAMPP in windows environment can sometimes be an issue. Here are some modifications to enable DOMPDF on a windows environment. ]]></description>
			<content:encoded><![CDATA[<p>Setting up the Dompdf (a pdf generation package in php) in XAMPP in windows environment can sometimes be an issue.<br />
After we have set up the package in the htdocs and go for testing the examples in the packages , error is encountered which is as follows-</p>
<p><span style="color: rgb(153, 153, 153);" mce_style="color: #999999;">A PHP Error was encountered<br />
Severity: Warning<br />
Message: domdocument::domdocument() expects at least 1 parameter, 0 given<br />
Filename: include/dompdf.cls.php<br />
Line Number: 165<br />
Fatal error: Call to undefined method domdocument::loadHTML() in C:\xampp\htdocs\bambooinvoice\bamboo_system_files\plugins\dompdf\include\dompdf.cls.php on line 284</span></p>
<p><span style="color: rgb(153, 153, 153);" mce_style="color: #999999;"><br />
<span style="color: rgb(0, 0, 0);" mce_style="color: #000000;">The error message is caused due to a conflict between DomDocument and DomXML extentions , so the first thing we did was to disable the domdocument extention in php.ini.<br />
extension = php_domxml.dll</span></span></p>
<p>After restarting the apache and then again running the examples again blank pages were being rendered. The problem was due to the fact that dompdf uses PDFLib by default if it is available in the system and PDFLib is a commercial package which is not available by default in the system but its extention is enabled in php.ini by default in the system.</p>
<p>So what we did was to comment out the PDFLib extension <b>extension=php_pdf.dll</b> in the php.ini file. After the modifications we restarted the apache and then the examples could be run on the XAMPP environment.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.diademblogs.com/phpmysql/setting-up-and-getting-dompdf-to-work-in-xampp-on-windows/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Improve Security using php.ini</title>
		<link>http://www.diademblogs.com/phpmysql/improve-security-using-phpini</link>
		<comments>http://www.diademblogs.com/phpmysql/improve-security-using-phpini#comments</comments>
		<pubDate>Wed, 25 Mar 2009 04:57:33 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP/MySQL]]></category>
		<category><![CDATA[php security]]></category>
		<category><![CDATA[php.ini]]></category>
		<category><![CDATA[Plesk]]></category>

		<guid isPermaLink="false">http://diadem.co.in/blog/?p=49</guid>
		<description><![CDATA[PHP has some vulnerable functions which can be used to break into your server if your scripts are not coded securely. You can setup a list of functions in php.ini using disable_functions directive. This directive allows you to disable certain functions for security reasons. It takes on a comma-delimited list of function names. This disable_functions [...]]]></description>
			<content:encoded><![CDATA[<p>PHP has some vulnerable functions which can be used to break into your server if your scripts are not coded securely. You can setup a list of functions in php.ini using disable_functions directive. This directive allows you to disable certain functions for security reasons. It takes on a comma-delimited list of function names. This <strong>disable_functions</strong> feature is not affected by Safe Mode. This directive must be set in php.ini For example, you cannot set this in httpd.conf</p>
<p>Open php.ini file:</p>
<p>#<code>vi /etc/php.ini</code></p>
<p>Find disable_functions and set new list as follows:</p>
<p><code>disable_functions =exec,passthru,shell_exec,system,proc_open,popen,curl_exec,</code></p>
<p><code>curl_multi_exec,parse_ini_file,show_source </code></p>
<p>Save and close the file. Restart httpd:</p>
<p><code># service httpd restart</code></p>
Note: There is a rating embedded within this post, please visit this post to rate it.
]]></content:encoded>
			<wfw:commentRss>http://www.diademblogs.com/phpmysql/improve-security-using-phpini/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Creating image thumbnails in php</title>
		<link>http://www.diademblogs.com/phpmysql/creating-image-thumbnails-in-php</link>
		<comments>http://www.diademblogs.com/phpmysql/creating-image-thumbnails-in-php#comments</comments>
		<pubDate>Thu, 19 Mar 2009 04:10:28 +0000</pubDate>
		<dc:creator>mithun</dc:creator>
				<category><![CDATA[PHP/MySQL]]></category>
		<category><![CDATA[dynamic image thumbnails]]></category>
		<category><![CDATA[thumbnail creation]]></category>
		<category><![CDATA[thumbnails in php]]></category>

		<guid isPermaLink="false">http://www.diademblogs.com/?p=473</guid>
		<description><![CDATA[Thumbnail are used by graphic designers and photographers for a small image representation of a larger image. The main advantage of creating thumbnails is that it generates the new image with the proportional dimension of the large image and hence the image resolution and quality remain intact. As the thumbnails are smaller in size they [...]]]></description>
			<content:encoded><![CDATA[<p>Thumbnail are used by graphic designers and photographers for a small image representation of a larger image. The main advantage of creating thumbnails is that it generates the new image with the proportional dimension of the large image and hence the image resolution and quality remain intact. As the thumbnails are smaller in size they load quickly and makes the page render faster as well.</p>
<p>We are using a thumbnail class to make code simpler and easy to use. Image extensions with jpg, gif and png are supported for creating thumbnail using this class.</p>
<p>Three easy steps to create and image thumbnail :</p>
<p><strong>Step 1. </strong>Create a folder and named  as createThumb.  Create a file named thumbnail_Class.php in the createThumb folder and paste the code given below into it.</p>
<blockquote><p>&lt;?<br />
function createThumb($srcname,$destname,$maxwidth,$maxheight)<br />
{<br />
$oldimg = $srcname;<br />
$newimg = $destname;</p>
<p>list($imagewidth,$imageheight,$imagetype)=@getimagesize($oldimg);</p>
<p>$shrinkage = 1;<br />
if ($imagewidth &gt; $maxwidth)<br />
$shrinkage = $maxwidth/$imagewidth;<br />
if($shrinkage !=1)<br />
{<br />
$dest_height = $shrinkage * $imageheight;<br />
$dest_width = $maxwidth;<br />
}<br />
else<br />
{<br />
$dest_height=$imageheight;<br />
$dest_width=$imagewidth;<br />
}<br />
if($dest_height &gt; $maxheight)<br />
{<br />
$shrinkage = $maxheight/$dest_height;<br />
$dest_width = $shrinkage * $dest_width;<br />
$dest_height = $maxheight;<br />
}<br />
if($imagetype==2)<br />
{<br />
$src_img = imagecreatefromjpeg($oldimg);<br />
$dst_img = imagecreatetruecolor($dest_width, $dest_height);<br />
imagecopyresampled($dst_img, $src_img, 0, 0, 0, 0, $dest_width, $dest_height, $imagewidth, $imageheight);<br />
imagejpeg($dst_img, $newimg, 75);<br />
imagedestroy($src_img);<br />
imagedestroy($dst_img);<br />
}</p>
<p>elseif ($imagetype == 3)<br />
{<br />
$src_img = imagecreatefrompng($oldimg);<br />
$dst_img = imagecreatetruecolor($dest_width, $dest_height);<br />
imagecopyresampled($dst_img, $src_img, 0, 0, 0, 0, $dest_width, $dest_height, $imagewidth, $imageheight);<br />
imagepng($dst_img, $newimg, 75);<br />
imagedestroy($src_img);<br />
imagedestroy($dst_img);<br />
}<br />
else<br />
{<br />
$src_img = imagecreatefromgif($oldimg);<br />
$dst_img = imagecreatetruecolor($dest_width, $dest_height);<br />
imagecopyresampled($dst_img, $src_img, 0, 0, 0, 0, $dest_width, $dest_height, $imagewidth, $imageheight);<br />
imagegif($dst_img, $newimg, 75);<br />
imagedestroy($src_img);<br />
imagedestroy($dst_img);<br />
}<br />
}<br />
?&gt;</p></blockquote>
<p><strong>Step 2. </strong> Create a file named index.php with in this folder and paste the code given below inside index.php. This is the file which you need to run from the browser. Place your image (e.g., grapes.jpg) to create thumbnail within the createThumb folder.</p>
<blockquote><p>&lt;?<br />
include(&#8216;thumbnail_Class.php&#8217;);</p>
<p>$filePath    =    &#8216;grapes.jpg&#8217;;<br />
$destPath    =    &#8216;Thumb_grapes.jpg&#8217;;<br />
$maxwidth        =    450;<br />
$maxheight        =    300;<br />
createThumb($filePath,$destPath,$maxwidth,$maxheight);</p>
<p>echo &#8216;Thumbnail Created.&#8217;;<br />
?&gt;</p></blockquote>
<p><strong>Step 3. </strong>Finally, Run the index.php from your browser and if your thumbnail is created successfully then you will get an message &#8220;Thumbnail Created&#8221; and the thumnail image will create in createThumb folder with name Thumb_grapes.jpg.<br />
<span id="more-473"></span></p>
<p>E..g,</p>
<div id="attachment_479" class="wp-caption alignnone" style="width: 810px"><img class="size-full wp-image-479" src="http://www.diademblogs.com/wp-content/uploads/2009/02/grapes.jpg" alt="Large Image" width="800" height="600" /><p class="wp-caption-text">Large Image</p></div>
<div id="attachment_480" class="wp-caption alignnone" style="width: 410px"><img class="size-full wp-image-480" src="http://www.diademblogs.com/wp-content/uploads/2009/02/thumb_grapes.jpg" alt="Thumnail Image" width="400" height="300" /><p class="wp-caption-text">Thumnail Image</p></div>
<p>That&#8217;s it. I hope this piece of code helps you in creating image thumbnails for your website with ease.</p>
Note: There is a rating embedded within this post, please visit this post to rate it.
]]></content:encoded>
			<wfw:commentRss>http://www.diademblogs.com/phpmysql/creating-image-thumbnails-in-php/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

