вопрос по изменению размеров изображения

lelik17

Новичок
вопрос по изменению размеров изображения

есть вот такая функция:

PHP:
function create_thumbnail( $source_file, $destination_file, $max_dimension)
{
    list($img_width,$img_height) = getimagesize($source_file); // Get the original dimentions
    $aspect_ratio = $img_width / $img_height;
    if ( ($img_width > $max_dimension) || ($img_height > $max_dimension) ) // If either dimension is too big...
    {
        if ( $img_width > $img_height ) // For wide images...
        {
            $new_width = $max_dimension;
            $new_height = $new_width / $aspect_ratio;
        }
        elseif ( $img_width < $img_height ) // For tall images...
        {
            $new_width = $max_dimension;
            $new_height = $new_width / $aspect_ratio;
        }
        elseif ( $img_width == $img_height ) // For square images...
        {
            $new_width = $max_dimension;
            $new_height = $max_dimension;
        }
        else { echo "Error reading image size."; return FALSE; }
    }
    else { $new_width = $img_width; $new_height = $img_height; } // If it's already smaller, don't change the size.

    // Make sure these are integers.
    $new_width = intval($new_width);
    $new_height = intval($new_height);

    $thumbnail = imagecreatetruecolor($new_width,$new_height); // Creates a new image in memory.

    // The following block retrieves the source file.  It assumes the filename extensions match the file's format.
    if ( (strpos($source_file,".gif")) || (strpos($source_file,".GIF")) ) { $img_source = imagecreatefromgif($source_file); }
    if ( (strpos($source_file,".jpg")) || (strpos($source_file,".jpeg") ) || (strpos($source_file,".JPG") ) || (strpos($source_file,".JPEG") ))
    { $img_source = imagecreatefromjpeg($source_file); }
    if ( strpos($source_file,".bmp") || (strpos($source_file,".BMP")) ) { $img_source = imagecreatefromwbmp($source_file); }
    if ( strpos($source_file,".png") || (strpos($source_file,".PNG"))) { $img_source = imagecreatefrompng($source_file); }

    // Here we resample and create the new jpeg.
    imagecopyresampled($thumbnail, $img_source, 0, 0, 0, 0, $new_width, $new_height, $img_width, $img_height);
    imagejpeg( $thumbnail, $destination_file, 55 );

    // Finally, we destroy the two images in memory.
    imagedestroy($img_source);
    imagedestroy($thumbnail);
}
если изображение небольшого разрешения, то всё работает прекрасно, а вот если превышает где-то 2000 пикселей, то не работает. файлы не создаёт, ошибок не выводит, просто белый экран. В чём может быть проблема?
 

AmdY

Пью пиво
Команда форума
смотри логи

error_reporting(E_ALL);
ini_set('display_errors', 'On');
 
Сверху