Ignore:
Timestamp:
Apr 1, 2012, 2:02:36 AM (12 years ago)
Author:
plg
Message:

feature 2604: support rotation on derivatives

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin/include/image.class.php

    r13736 r13843  
    239239    }
    240240
    241     $rotation = null;
     241    $rotation = 0;
    242242
    243243    $exif = exif_read_data($source_filepath);
     
    261261
    262262    return $rotation;
     263  }
     264
     265  static function get_rotation_code_from_angle($rotation_angle)
     266  {
     267    switch($rotation_angle)
     268    {
     269      case 0:   return 0;
     270      case 90:  return 1;
     271      case 180: return 2;
     272      case 270: return 3;
     273    }
     274  }
     275
     276  static function get_rotation_angle_from_code($rotation_code)
     277  {
     278    switch($rotation_code)
     279    {
     280      case 0: return 0;
     281      case 1: return 90;
     282      case 2: return 180;
     283      case 3: return 270;
     284    }
    263285  }
    264286
     
    424446  {
    425447    $this->image->setInterlaceScheme(Imagick::INTERLACE_LINE);
    426     if ($this->get_width()%2 == 0 && $this->get_height()%2 == 0
    427       && $this->get_width() > 3*$width)
     448   
     449    // TODO need to explain this condition
     450    if ($this->get_width()%2 == 0
     451        && $this->get_height()%2 == 0
     452        && $this->get_width() > 3*$width)
    428453    {
    429454      $this->image->scaleImage($this->get_width()/2, $this->get_height()/2);
    430455    }
     456
    431457    return $this->image->resizeImage($width, $height, Imagick::FILTER_LANCZOS, 0.9);
    432458  }
Note: See TracChangeset for help on using the changeset viewer.