<?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>Stillcetek &#187; PHP</title>
	<atom:link href="http://www.stillcetek.com/category/php/feed" rel="self" type="application/rss+xml" />
	<link>http://www.stillcetek.com</link>
	<description>Blog Lukman Stillcetek, Delphi Tutorial, Php Tutorial, Article CSS, Mysql, Javascript Tutorial, MSSQL Server, Linux Ubuntu</description>
	<lastBuildDate>Fri, 23 Jul 2010 06:50:02 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Warning Session di PHP 4</title>
		<link>http://www.stillcetek.com/2007-07-14/warning-session-di-php-4.html</link>
		<comments>http://www.stillcetek.com/2007-07-14/warning-session-di-php-4.html#comments</comments>
		<pubDate>Sat, 14 Jul 2007 04:03:21 +0000</pubDate>
		<dc:creator>Lukman</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.stillcetek.com/2007-07-14/warning-session-di-php-4.html</guid>
		<description><![CDATA[Saya ketemu bugs warning session saat develop website, emm, lumayan bingung, abis bahasa inggrisnya juga lumayan kacau.
Warning: Unknown(): Your script possibly relies on a session side-effect which existed until PHP 4.2.3. Please be advised that the session extension does not consider global variables as a source of data, unless register_globals is enabled. You can disable [...]]]></description>
			<content:encoded><![CDATA[<p>Saya ketemu bugs warning session saat develop website, emm, lumayan bingung, abis bahasa inggrisnya juga lumayan kacau.</p>
<p><em><strong>Warning</strong>: Unknown(): Your script possibly relies on a session side-effect which existed until PHP 4.2.3. Please be advised that the session extension does not consider global variables as a source of data, unless register_globals is enabled. You can disable this functionality and this warning by setting session.bug_compat_42 or session.bug_compat_warn to off, respectively. in <strong>Unknown</strong> on line <strong>0</strong></em></p>
<p>Udah nanya ama my master dapat deh jawabannya, matikan register_globals dengan init_set();</p>
<p>Matikan juga warning untuk session. Kodenya sebagai berikut:</p>
<p>ini_set(&#8217;register_globals&#8217;,'Off&#8217;);<br />
ini_set(&#8217;session.bug_compat_warn&#8217;,0);</p>
<p>Hengkang deh warning!!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.stillcetek.com/2007-07-14/warning-session-di-php-4.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Membuat Thumbnail Images Dengan PHP</title>
		<link>http://www.stillcetek.com/2007-07-13/php-resize-images-create-thumbnail-images.html</link>
		<comments>http://www.stillcetek.com/2007-07-13/php-resize-images-create-thumbnail-images.html#comments</comments>
		<pubDate>Fri, 13 Jul 2007 15:25:59 +0000</pubDate>
		<dc:creator>Lukman</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.stillcetek.com/2007-07-13/php-resize-images-create-thumbnail-images.html</guid>
		<description><![CDATA[Aku punya koleksi fhoto dan kepengen tak upload ke stillcetek gallery, tapi ukuran fhoto-fhoto itu ada yang lebih dari 2000 bahkan 3000 pixel, wah kalo tak upload mentah-mentah bisa empot-empotan space stillcetek. Pengennya di resize jadi 600 pixel aja semua. Kalo pake adobe photoshop di kecilin satu-satu lama. terus coba minta bantuan mbah google nemu [...]]]></description>
			<content:encoded><![CDATA[<p>Aku punya koleksi fhoto dan kepengen tak upload ke stillcetek gallery, tapi ukuran fhoto-fhoto itu ada yang lebih dari 2000 bahkan 3000 pixel, wah kalo tak upload mentah-mentah bisa empot-empotan space stillcetek. Pengennya di resize jadi 600 pixel aja semua. Kalo pake adobe photoshop di kecilin satu-satu lama. terus coba minta bantuan mbah google nemu deh beberapa contoh untuk meresize image pake php. sedikit dimodif jadi deh sesuai dengan yang aku butuhkan.<br />
Pastikan apache support dengan GD, Graphics library untuk mengolah image ala programmer.</p>
<p>ini nih fungsinya :</p>
<pre>
function createThumbnail($imageDirectory, $imageName,
                         $thumbName, $thumbsize, $thumbDirectory="")
{
  $fileType = strtolower(substr($imageName, -3));
  if ($fileType=='jpg')
  {
    $srcImg=imagecreatefromjpeg($imageDirectory.'/'.$imageName);
  }
  elseif ($fileType=='png')
  {
    $srcImg=imagecreatefrompng($imageDirectory.'/'.$imageName);
  }
  else
  {
    echo "&lt;br&gt;No Support images".$imageDirectory.'/'.$imageName;
  }
  if ($fileType=='jpg' || $fileType=='png')
  {
  $oldWidth = imageSX($srcImg);
  $oldHeight = imageSY($srcImg);

if ($oldWidth &gt; $oldHeight)
  {
    $newWidth = $thumbsize;
    $newHeight = $oldHeight*($thumbsize/$oldWidth);
  } 

  if ($oldWidth &lt; $oldHeight)
  {
    $newWidth = $oldWidth*($thumbsize/$oldHeight);
    $newHeight = $thumbsize;
  } 

  if ($oldWidth == $oldHeight)
  {
    $newWidth = $thumbsize;
    $newHeight = $thumbsize;
  }

  $thumbImg=ImageCreateTrueColor($newWidth,$newHeight);
  imagecopyresampled($thumbImg,$srcImg,0,0,0,0,$newWidth,
                     $newHeight,$oldWidth,$oldHeight);

  if ($thumbDirectory==""){
    imagejpeg($thumbImg,'',$thumbsize);
  }else{
    imagejpeg($thumbImg,$thumbDirectory.'/'.$thumbName.$imageName);
  }
  }
}</pre>
<p>Fungsi ini hanya bisa meresize images jpg dan png.</p>
<p>Keterangan parameter :</p>
<ul>
<li>$imageDirectory : Folder letak source images</li>
<li>$imageName : Nama images yang akan diresize</li>
<li> $thumbName : Pemberian nama awal thumbnail</li>
<li> $thumbsize : Ukuran thumbnail (pixel)</li>
<li> $thumbDirectory : letak folder hasil thumbnail, Jika parameter $thumbDirectory null maka fungsi akan menghasilkan kode binary dari hasil resize, yang bisa dimasukkan kedalam database.</li>
</ul>
<p>Contoh:</p>
<pre>createThumbnail("img/", "sea.jpg", "thumb_", 600,"thumbs/" );</pre>
<p>Jika banyak foto yang mau diresize, berikut contohnya:</p>
<p>Fungsi untuk mendapatkan list images di directory :</p>
<pre>function getListImages($dir)
{
 $images = array();
 if (is_dir($dir)) {
  if ($d = opendir($dir)) {
   while (($file = readdir($d)) !== false) {
    if ($file!="." &amp;&amp; $file!="..")
    {
      $images[] = $file;
    }
   }
  closedir($d);
  }
}
return $images;
}</pre>
<p>Pemakaian kedua fungsi diatas :</p>
<pre>$sourceImages = "C:/Data/Fhoto/album1";
$thumbImages = "gallery/thumbs/album1";
$thumbSize = 600;
$thumbName = "thumb_";

$getImages=getListImages($sourceImages);

if (is_array($getImages))
{
  foreach($getImages as $i=&gt; $img)
  {
   if (!file_exists("$thumbImages/$img")){
     createThumbnail($sourceImages, $img, $thumbName,
                     $thumbSize,$thumbImages);
   }
  }
  echo "$i thumbs has been created";
 }
 else
 {
   echo "No Images found!";
 }</pre>
<p>Demikian semoga bermanfaat.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.stillcetek.com/2007-07-13/php-resize-images-create-thumbnail-images.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
