Autor Zpráva
hehe123
Profil *
function resizeImage($filename, $newwidth, $newheight)
{
list($width, $height) = getimagesize($filename);
if($width > $height && $newheight < $height){
$newheight = $height / ($width / $newwidth);
} else if ($width < $height && $newwidth < $width) {
$newwidth = $width / ($height / $newheight);
} else {
$newwidth = $width;
$newheight = $height;
}
$thumb = imagecreatetruecolor($newwidth, $newheight);
$source = imagecreatefromjpeg($filename);
imagecopyresized($thumb, $source, 0, 0, 0, 0, $newwidth, $newheight, $width, $height);
return imagepng($thumb);
}
hehe123
Profil *
Dotaz je taky aby mi to dokazalo zmensit aj fotky ktore su GIF, PNG..co tam mam pridat?
nightfish
Profil
$source = imagecreatefromjpeg($filename);
tenhle řádek musí nabývat různých podob pro různé formáty fotek
ke zjištění formátu fotky pomůže funkce getimagesize()
hehe123
Profil *
a nenapisal by mi to niekto??
Kcko
Profil
Ne

staci ti toto

getImageSize
Switch
prisluna fce pro dany mime typ

Vaše odpověď

Mohlo by se hodit


Prosím používejte diakritiku a interpunkci.

Ochrana proti spamu. Napište prosím číslo dvě-sta čtyřicet-sedm:

0