function resimcek($link, $idx, $folder)
{
$image_with = 333;
$resimbul = @explode('/',$link);
$dosyaadi = end($resimbul);
$uzantibul = pathinfo($dosyaadi);
$uzanti = $uzantibul['extension'];
$dosyaadi = $idx.'.'.$uzanti;
$dest = $folder.$idx.".jpg";
$curl = curl_init($link);
$fopen = fopen($dest,'w');
curl_setopt($curl, CURLOPT_HEADER,0);
curl_setopt($curl, CURLOPT_RETURNTRANSFER,1);
curl_setopt($curl, CURLOPT_HTTP_VERSION,CURL_HTTP_VERSION_1_0);
curl_setopt($curl, CURLOPT_FILE, $fopen);
curl_exec($curl);
curl_close($curl);
fclose($fopen);
if($uzanti == "jpg")
{
$resim = @imagecreatefromjpeg($dest);
}
else if($uzanti == "png")
{
$resim = @imagecreatefrompng($dest);
}
else if($uzanti == "gif")
{
$resim = @imagecreatefromgif($dest);
}
else if($uzanti == "bmp")
{
$resim = @imagecreatefromwbmp($dest);
}
else
{
return false;
}
$boyutlar = getimagesize($dest);
$resimorani = $image_with / $boyutlar[0];
$yeniyukseklik = $resimorani*$boyutlar[1];
$yeniresim = @imagecreatetruecolor($image_with, $yeniyukseklik);
@imagecopyresampled($yeniresim, $resim, 0, 0, 0, 0, $image_with, $yeniyukseklik, $boyutlar[0], $boyutlar[1]);
!imagejpeg($yeniresim, $dest, 100);
@imagedestroy($yeniresim);
chmod ($dest, 0755);
}