У меня выскакивает ошибка:
Fatal error: Out of memory (allocated 16515072) (tried to allocate 4608 bytes) in /usr/home/school4dnua/data/www/school4.dn.ua/bl/add_photo.php on line 41
при выполнении банально простого задания =)
CODE (htmlphp):
скопировать код в буфер обмена
скопировать код в буфер обмена
- if (!move_uploaded_file($_FILES['photo']['tmp_name'], $file_original)) exit('{"stat":"false"}'); else
- {
- list($width, $height) = getimagesize($file_original);
- if($width<1000) exit('{"stat":"false"}');
- $new_width = 1000;
- $new_height = $width / $new_width;
- $new_height = $height / $new_height;
- $new_height = floor($new_height);
- if($format == "jpg")
- {
- $image_p = imagecreatetruecolor($new_width, $new_height);
- $image = imagecreatefromjpeg($file_original);
- imagecopyresampled($image_p, $image, 0, 0, 0, 0, $new_width, $new_height, $width, $height);
- }
- else if($format == "png")
- {
- $image_p = imagecreatetruecolor($new_width, $new_height);
- $image = imagecreatefrompng($file_original);
- imagecopyresampled($image_p, $image, 0, 0, 0, 0, $new_width, $new_height, $width, $height);
- }
- $w_m_y = $new_height - 61;
- $watermark = imagecreatefrompng("../images/img_watermark.png");
- imagealphablending($watermark, true);
- imagecopy($image_p, $watermark, 662, $w_m_y, 0, 0, 338, 61);
- }