imagecopyresized()
2 отговора
92 прегледа
imagecopyresized()
imam problem s generirane na thumbnails
polzvam tova:
<?php
function thumbnail($i,$nw,$p,$nn) {
$img=imagecreatefromjpeg("$i");
$ow=imagesx($img);
$oh=imagesy($img);
$scale=$nw/$ow;
$nh=ceil($oh*$scale);
$newimg=imagecreate($nw,$nh);
imagecopyresized($newimg,$img,0,0,0,0,$nw,$nh,$ow,$oh);
imagejpeg($newimg, $p.$nn);
return true;
}
#thumbnail(filetouse,newwidth,newpath,newname);
thumbnail("x.jpg",100,"th/","xt.jpg");
?>
Problema e 4e thumbnaila e s mnooooogo losho ka4estvo
ima li na4in da se podobri?
polzvam tova:
<?php
function thumbnail($i,$nw,$p,$nn) {
$img=imagecreatefromjpeg("$i");
$ow=imagesx($img);
$oh=imagesy($img);
$scale=$nw/$ow;
$nh=ceil($oh*$scale);
$newimg=imagecreate($nw,$nh);
imagecopyresized($newimg,$img,0,0,0,0,$nw,$nh,$ow,$oh);
imagejpeg($newimg, $p.$nn);
return true;
}
#thumbnail(filetouse,newwidth,newpath,newname);
thumbnail("x.jpg",100,"th/","xt.jpg");
?>
Problema e 4e thumbnaila e s mnooooogo losho ka4estvo
ima li na4in da se podobri?
Re: imagecopyresized() - za tova stavalo duma
<?php
function thumbnail($i,$nw,$p,$nn) {
$img=imagecreatefromjpeg("$i");
$ow=imagesx($img);
$oh=imagesy($img);
$scale=$nw/$ow;
$nh=ceil($oh*$scale);
$newimg=imagecreatetruecolor($nw,$nh);
imagecopyresampled($newimg,$img,0,0,0,0,$nw,$nh,$ow,$oh);
imagejpeg($newimg, $p.$nn);
return true;
}
#thumbnail(filetouse,newwidth,newpath,newname);
thumbnail("x.jpg",250,"th/","xt.jpg");
?>
function thumbnail($i,$nw,$p,$nn) {
$img=imagecreatefromjpeg("$i");
$ow=imagesx($img);
$oh=imagesy($img);
$scale=$nw/$ow;
$nh=ceil($oh*$scale);
$newimg=imagecreatetruecolor($nw,$nh);
imagecopyresampled($newimg,$img,0,0,0,0,$nw,$nh,$ow,$oh);
imagejpeg($newimg, $p.$nn);
return true;
}
#thumbnail(filetouse,newwidth,newpath,newname);
thumbnail("x.jpg",250,"th/","xt.jpg");
?>