<?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>dosya boyutu hesaplama &#8211; Selman Tunc</title>
	<atom:link href="https://selmantunc.com.tr/tag/dosya-boyutu-hesaplama/feed/" rel="self" type="application/rss+xml" />
	<link>https://selmantunc.com.tr</link>
	<description></description>
	<lastBuildDate>Thu, 14 Jun 2012 16:08:00 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.0</generator>

<image>
	<url>https://selmantunc.com.tr/wp-content/uploads/2023/07/cropped-tumblr_inline_oglumuMbgO1tyldvk_540-150x150-1-32x32.jpg</url>
	<title>dosya boyutu hesaplama &#8211; Selman Tunc</title>
	<link>https://selmantunc.com.tr</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>php Dosya boyutu hesaplama</title>
		<link>https://selmantunc.com.tr/uncategorized/php-dosya-boyutu-hesaplama/</link>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Thu, 14 Jun 2012 16:08:00 +0000</pubDate>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[dosya boyutu hesaplama]]></category>
		<category><![CDATA[filesize]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[php filesize]]></category>
		<guid isPermaLink="false">http://selmantunc.com.tr/2012/06/14/php-dosya-boyutu-hesaplama/</guid>

					<description><![CDATA[php  ile bir klasör içindeki dosyaların boyutunu nasıl hesaplarız, ben burada bi resim klasorundeki resimleri hesapladım siz kendinize göre değiştirebilisiniz &#8230;.Demo için tıklayın  indirmek için tıklayınız [dm]108[/dm] $uzanti='jpg'; //uzantıyı bul&#8230;]]></description>
										<content:encoded><![CDATA[<p>php  ile bir klasör içindeki dosyaların boyutunu nasıl hesaplarız, ben burada bi resim klasorundeki resimleri hesapladım siz kendinize göre değiştirebilisiniz &hellip;.<br /><br /><a href="http://www.selmantunc.com/labs/filesize/" target="_blank" rel="noopener">Demo için tıklayın <img fetchpriority="high" decoding="async" class="alignnone" title="http://www.selmantunc.com/labs/filesize/sit.jpg" src="http://www.selmantunc.com/labs/filesize/sit.jpg" alt="" width="323" height="225" /></a> <a href="http://www.selmantunc.com/?file_id=108"> indirmek için tıklayınız</a> [dm]108[/dm]<br /><br /><a name="more"></a>
<br /><pre class="brush:php"><br /><br /><br />$uzanti='jpg';<br /><br /> //uzantıyı bul<br /> function ext($filename)  {<br /> return strtolower(substr(strrchr($filename, '.'), 1));//nokta silinsede olurdu ama ekledim<br /> }<br /><br /> function convertBytes($value)<br /> {<br /> if (is_numeric($value)) {<br /> return $value;<br /> }<br /> else<br /> {<br /> $value_length = strlen($value);<br /> $qty = substr($value, 0, $value_length - 1);<br /> $unit = strtolower(substr($value, $value_length - 1));<br /> switch ($unit)<br /> {<br /> case 'k':<br /> $qty <em>= 1024;<br /> break;<br /> case 'm':<br /> $qty </em>= 1048576;<br /> break;<br /> case 'g':<br /> $qty <em>= 1073741824;<br /> break;<br /> }<br /> return $qty;<br /> }<br /> }<br /><br /> function roundSize($filesize, $phpConfig = false)<br /> {<br /><br /> if ($filesize  $filesize = sprintf("%u", $filesize);<br /> }<br /> if ($filesize &gt;= 1073741824) {<br /> $filesize = round($filesize / 1073741824 </em> 100) / 100 . ($phpConfig ? "G" : " G" . $size_unit);<br /> }<br /> elseif ($filesize &gt;= 1048576) {<br /> $filesize = round($filesize / 1048576 <em> 100) / 100 . ($phpConfig ? "M" : " M" . $size_unit);<br /> }<br /> elseif ($filesize &gt;= 1024) {<br /> $filesize = round($filesize / 1024 </em> 100) / 100 . ($phpConfig ? "K" : " K" . $size_unit);<br /> }<br /> else {<br /> $filesize = $filesize . " " . $size<em>unit;<br /> }<br /> if ($filesize == 0) {<br /> $filesize = "-";<br /> }<br /> return $filesize;<br /> }<br /><br />function percent($a,$b){<br />$sonuc=$a/$b;<br />return $sonuc=round($sonuc*100);<br />}<br /><br />function folder</em>($dizin,$uzanti){<br />if ($handle = opendir("$dizin") or die ("Dizin acilamadi!")) {<br /><br /> while (false !== ($file = readdir($handle))) {<br /> $filetype = ext($file);<br /> if(is_file($dizin."/".$file) &amp;&amp; $filetype == "$uzanti")<br /> {<br /> $deger=convertBytes(filesize( $dizin.'/'.$file)) ;<br /> $boyutlar[] =$deger;<br /> }  } //while end<br />$e=array_sum($boyutlar);<br /><br /> $e=roundSize($e);<br />$dilim = explode(" ", $e);//eğer k cinsi yani kilo byat değeri gelirse onun için<br />$bak=$dilim[1]; <br /><br />if ($bak=='K'){$e='0 M';}<br /><br />$e= substr($e, 0, -2);<br />return $e2=floor( number<em>format($e))+1;<br />closedir($handle);<br />}<br />}<br /><br /> $a1=folder</em>('../../resimler/sayfa<em>resimleri',$uzanti);<br /> $a2=folder</em>("../../resimler/sayfa<em>resimleri/thumb",$uzanti);<br /> $a3=folder</em>("../../resimler/sayfa<em>resimleri/mini",$uzanti);<br /><br /> $a4=folder</em>("../../resimler/firma<em>resimleri/thumb",$uzanti);<br /> $a5=folder</em>("../../resimler/firma_resimleri",$uzanti);<br /> $e2=$a1+$a2+$a3+$a4+$a5;<br /><br />$total=250;//web sitemizin genel boyutu<br />$sisitemin_kullandigi=20;//siistem klasorleri php ve images vss ne kadar kullnıyor<br />$total=$total-$sisitemin_kullandigi;<br />$remaining=$total - $e2;<br />$pluspercent1=percent($remaining,$total);//toplam yüzde boş alan<br />//echo '<br />';<br /> $pluspercent=100-percent($remaining,$total);//yüzde dolu alan<br />$total1=$total.'/'. $remaining;<br /><br />//burada json olarak çıktı verdim<br /> echo '{"post":[ {<br /> "total_host":"'.$total1.'", <br /><br /> "pluspercent":"'.$pluspercent.'%'.'",<br /> "result":"ok" }]}';<br />?&gt;</pre></p>]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
