Changeset 9953


Ignore:
Timestamp:
Mar 31, 2011, 5:30:43 PM (13 years ago)
Author:
patdenice
Message:

Accept gif format (only GD)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/square_thumbnails/trunk/functions.inc.php

    r9773 r9953  
    141141  }
    142142
    143   if (is_imagick())
     143  $extension = strtolower(get_extension($source_filepath));
     144
     145  if (is_imagick() and $extension != 'gif')
    144146  {
    145147    return upload_square_resize_im($source_filepath, $destination_filepath, $max_width, $max_height, $quality, $strip_metadata);
     
    157159    return false;
    158160  }
     161
     162  $gd_info = gd_info();
    159163
    160164  // extension of the picture filename
     
    170174    $source_image = @imagecreatefrompng($source_filepath);
    171175  }
    172   else
    173   {
    174     die('unsupported file extension');
     176  elseif ($extension == 'gif' and $gd_info['GIF Read Support'] and $gd_info['GIF Create Support'])
     177  {
     178    $source_image = @imagecreatefromgif($source_filepath);
     179  }
     180  else
     181  {
     182    die('[GD] unsupported file extension');
    175183  }
    176184
     
    224232    imagepng($destination_image, $destination_filepath);
    225233  }
     234  elseif ($extension == 'gif')
     235  {
     236    imagegif($destination_image, $destination_filepath);
     237  }
    226238  else
    227239  {
     
    303315    $conf['thumbnails_ratio_orientation'] = true;
    304316
    305   if (!$conf['thumbnails_ratio_orientation'] and $rotation)
    306     $conf['thumbnails_ratio_orientation'] = true;
    307 
    308317  $x = 0;
    309318  $y = 0;
    310319
    311   if ($source_width >= $source_height or !$conf['thumbnails_ratio_orientation'])
     320  if (!$conf['thumbnails_ratio_orientation'] and in_array($rotation, array(90, 270)))
     321    list($heightRatio, $widthRatio) = explode(':', $conf['thumbnails_ratio']);
     322
     323  elseif ($source_width >= $source_height or !$conf['thumbnails_ratio_orientation'])
    312324    list($widthRatio, $heightRatio) = explode(':', $conf['thumbnails_ratio']);
     325
    313326  else
    314327    list($heightRatio, $widthRatio) = explode(':', $conf['thumbnails_ratio']);
Note: See TracChangeset for help on using the changeset viewer.