kodu test etmedim, umarım çalışır.
<?php
function resim_resize($resimPath,$en,$boy)
{
$return = array();
$imgInfo = array();
$imgInfo = getimagesize($resimPath);
$newVal = $imgInfo[0] < $imgInfo[1] ? $boy : $en;
while(1)
{
$return["boy"] = ($newVal / $imgInfo[0]) * $imgInfo[1];
$return["en"] = $newVal;
if ($return["en"] <= $en && $return["boy"] <= $boy)
{
return $return;
}else{
$newVal -= 3;
}
}
}
function resim_create($resimPath, $resimType, $yeniResimPath, $resimEn,
$resimBoy, $scale = false, $kalite = 90)
{
$resimResize = array();
$imgInfo = array();
//deigisklik yapilacak resme ait en boy bilgilerini alir
$imgInfo = getimagesize($resimPath);
//resmi oransal olarak kucultmek icin
if ($scale == false)
{
$resimResize = resim_resize($resimPath, $resimEn, $resimBoy);
}else { //belirlediginiz boyutlara sundurur
$resimResize["en"] = $resimEn;
$resimResize["boy"] = $resimBoy;
}
$im = ImageCreateTrueColor($resimResize["en"], $resimResize["boy"]);
if ($resimType == "image/jpg" || $resimType == "image/jpeg" ||
$resimType == "image/pjpeg")
{
$image = ImageCreateFromJpeg($resimPath);
if (!$image)
return false;
}else if ($resimType == "image/gif"){
$image = ImageCreateFromGif($resimPath);
if (!$image)
return false;
}else if ($resimType == "image/png" || $resimType == "image/x-png"){
$image = ImageCreateFromPng($resimPath);
if (!$image)
return false;
}
imagecopyResampled($im, $image, 0, 0, 0, 0, $resimResize["en"],
$resimResize["boy"], $imgInfo[0], $imgInfo[1]);
//boyutlari ve kalitesi degismis yeni resmi olusturur
imagejpeg($im,$yeniResimPath,$kalite);
return;
}
On 01/24/2011 02:48 PM, Erdem ARTAN wrote:
Öyleyse o adresteki imagejpeg gibi fonksiyonlara bakmamışsınız:
http://www.php.net/manual/tr/function.imagejpeg.php
Erdem Artan
Pardus-Linux.Org
2011/1/24 What you get is Not what you see <[email protected]
<mailto:[email protected]>>
Tesekkurler.Ama zaten biliyordum o URLi.
2011/1/24 Erdem ARTAN <[email protected] <mailto:[email protected]>>
Aradığınız şey GD sanırım.
http://www.php.net/manual/tr/book.image.php
_______________________________________________
Linux-programlama mailing list
[email protected]
https://liste.linux.org.tr/mailman/listinfo/linux-programlama
Liste kurallari: http://liste.linux.org.tr/kurallar.php
--
/**
* @author Atıf CEYLAN
* Software Developer& System Admin
* http://www.atifceylan.com
*/
_______________________________________________
Linux-programlama mailing list
[email protected]
https://liste.linux.org.tr/mailman/listinfo/linux-programlama
Liste kurallari: http://liste.linux.org.tr/kurallar.php