Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $filename = './'.$fold.'/' . mt_rand(100,999) . date('YmdHis') . mt_rand(100,999) . '.' . $match[1]; //создаем уникальное имя
- $info = getimagesize($image);//получили размер
- $w = $info[0];
- $h = $info[1];
- $create = 'imagecreatefrom' . $type;
- $img = $create($filename);
- //вычисляем
- $ratio = min($width/$w, $height/$h);
- $width = $w * $ratio;
- $height = $h * $ratio;
- $x = 0;
- $new = imagecreatetruecolor($width, $height);
- imagecopyresampled( $new, $img, 0, 0, $x, 0, $width, $height, $w, $h );
- //вот тут даем картинке уникальное имя и как-то записываем ее
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement