PHP Thumbnail yapma
Php ile resimlerin önizleme boyutlarını yaparak sitenizde kullanabilirsiniz. GD kullanarak resimlerin küçüklerini olusturma
<?php
function makeThumb($f, $w, $h)
{
$im = imagecreatetruecolor ($w, $h);
$imx = imagecreatefromjpeg($f);
$xxx = getimagesize($f);
imagecopyresampled($im, $imx, 0, 0, 0, 0, $w, $h, $xxx[0], $xxx[1]);
imagejpeg ($im);
imagedestroy($im);
imagedestroy($imx);
}
//==========================
// Örnek kullanim :
/*1. parametre dosya, ikinci parametre genislik, 3. parametre de uzunluk
makeThumb('benimdosya.jpg', 10, 10); */
?>
function makeThumb($f, $w, $h)
{
$im = imagecreatetruecolor ($w, $h);
$imx = imagecreatefromjpeg($f);
$xxx = getimagesize($f);
imagecopyresampled($im, $imx, 0, 0, 0, 0, $w, $h, $xxx[0], $xxx[1]);
imagejpeg ($im);
imagedestroy($im);
imagedestroy($imx);
}
//==========================
// Örnek kullanim :
/*1. parametre dosya, ikinci parametre genislik, 3. parametre de uzunluk
makeThumb('benimdosya.jpg', 10, 10); */
?>
Yorumlar
Yeni yorum veya soru gönder