Hey, jak zrobic dopasowanie skalowanie obrazka do kształtu kwadratu?
Mam stworzyć moduły gd dla
if(!empty($w) && empty($h)){//obliczanie h - wysokosi
}
if (empty($w) && !empty($h)) {//obliczanie w- szrokosci
}
prosze o pomoc
$image = imagecreatefrompng($_FILES['file']['tmp_name']); $width = imagesx($image); $height = imagesy($image); if ($width > 100 && $height > 100) { if ($width > 700 || $height > 600) { $img = imagecreatetruecolor(700, 600); imagecopyresampled($img, $image, 0, 0, 0, 0, 700, 600, $width, $height); }else{ $img = $image; } $img_mini = imagecreatetruecolor(100, 100); imagecopyresampled($img_mini, $image, 0, 0, 0, 0, 100 , 100, $width , $height); imagedestroy($img_mini); imagedestroy($image); if ($width > 700 || $height > 600) { imagedestroy($img); }