Am o functie care face resize la niste imagini. Ea arata cam asa:
Cod:
function createThumbnail($imageDirectory, $imageName, $thumbDirectory, $thumbWidth, $newName)
{
$srcImg = imagecreatefromjpeg("$imageDirectory/$imageName");
$origWidth = imagesx($srcImg);
$origHeight = imagesy($srcImg);
$ratio = $origWidth / $thumbWidth;
$thumbHeight = ceil($origHeight / $ratio);
$thumbImg = imagecreatetruecolor($thumbWidth, $thumbHeight);
imagecopyresized($thumbImg, $srcImg, 0, 0, 0, 0, $thumbWidth, $thumbHeight, $origWidth, $origHeight);
imagejpeg($thumbImg, "$thumbDirectory/$newName", 100);
}
si este apelata in felul urmator:
Cod:
createThumbnail("poze", "$poza_mare", "poze", 300, "$poza_mare");
Intrebarea ar fi de ce pozele micsorate nu sunt clare ?