Я правильно понимаю, что если мы вставим это:MIT писал(а):принудительное освобождение памяти.
то можно поставить мультиаплоад, т.к. после обработки одного файла память будет очищаться?MIT писал(а):imagedestroy($source);
Я правильно понимаю, что если мы вставим это:MIT писал(а):принудительное освобождение памяти.
то можно поставить мультиаплоад, т.к. после обработки одного файла память будет очищаться?MIT писал(а):imagedestroy($source);
как добавить в этот код bmp расширение,чтобы уменьшало и загружаеміе bmp файлиromeo_piter писал(а):Дмитрий, я откровенно бессилен в php )
В чем преимущество вашего кода?
У меня код немного другой, посвежее, чем по ссылке, выглядит так (брал с этого форума):
Код: Выделить всё
/** * Resize images with the true diemensions * version 0.31 */ function resize_images() { if ( $this->is_image() ) { $limit_width = 800; $limit_height = 768; $quality = 90; $size = getimagesize($this->destination_file); $width = $size[0]; $height = $size[1]; if($height > $limit_height OR $width > $limit_width) { $int_factor = min(($limit_width / $width), ($limit_height / $height)); // pano-test add // if (max($width, $height) / min($width, $height) > 2) $int_factor = $int_factor * 1.5; // end $width = round($width * $int_factor); $height = round($height * $int_factor); $destination = imagecreatetruecolor($width, $height); if ( $this->extension == "jpg" || $this->extension == "jpeg" ) { @ini_set('gd.jpeg_ignore_warning', 1); $source = imagecreatefromjpeg($this->destination_file); } elseif ( $this->extension == "png" ) { @imagealphablending($destination, false); @imagesavealpha($destination, true); $source = imagecreatefrompng($this->destination_file); } elseif ( $this->extension == "gif" ) { $source = imagecreatefromgif($this->destination_file); $trnprt_indx = imagecolortransparent($source); if ($trnprt_indx >= 0) //transparent { $trnprt_color = imagecolorsforindex($source, $trnprt_indx); $trnprt_indx = imagecolorallocate($destination, $trnprt_color['red'], $trnprt_color['green'], $trnprt_color['blue']); imagefill($destination, 0, 0, $trnprt_indx); imagecolortransparent($destination, $trnprt_indx); } } imagecopyresampled($destination, $source, 0, 0, 0, 0, $width, $height, $size[0], $size[1]); $black = imagecolorallocate($destination,255,255,255); $str = "www.mysite.ru"; imagestring($destination,5,8,4,$str, $black); if ( $this->extension == "jpg" || $this->extension == "jpeg" ) imagejpeg($destination, $this->destination_file, $quality); elseif ( $this->extension == "png" ) imagepng($destination, $this->destination_file); elseif ( $this->extension == "gif" ) imagegif($destination, $this->destination_file); imagedestroy($destination); } } }