Changeset 13843 for trunk/i.php


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/i.php

    r13736 r13843  
    445445  try
    446446  {
    447     $query = 'SELECT coi, width, height FROM '.$prefixeTable.'images WHERE path=\''.$page['src_location'].'\'';
     447    $query = '
     448SELECT
     449    id,
     450    coi,
     451    width,
     452    height,
     453    rotation
     454  FROM '.$prefixeTable.'images
     455  WHERE path=\''.$page['src_location'].'\'
     456;';
     457   
    448458    if ( ($row=pwg_db_fetch_assoc(pwg_query($query))) )
    449459    {
     
    453463      }
    454464      $page['coi'] = $row['coi'];
     465
     466      include_once(PHPWG_ROOT_PATH . 'admin/include/image.class.php');
     467
     468      if (empty($row['rotation']))
     469      {
     470        $page['rotation_angle'] = pwg_image::get_rotation_angle($page['src_path']);
     471       
     472        single_update(
     473          $prefixeTable.'images',
     474          array('rotation' => pwg_image::get_rotation_code_from_angle($page['rotation_angle'])),
     475          array('id' => $row['id'])
     476          );
     477      }
     478      else
     479      {
     480        $page['rotation_angle'] = pwg_image::get_rotation_angle_from_code($row['rotation']);
     481      }
     482
    455483    }
    456484    if (!$row)
     
    472500  ierror("dir create error", 500);
    473501}
    474 
    475 include_once(PHPWG_ROOT_PATH . 'admin/include/image.class.php');
    476502
    477503ignore_user_abort(true);
     
    483509$changes = 0;
    484510
    485 // todo rotate
     511// rotate
     512if (0 != $page['rotation_angle'])
     513{
     514  $image->rotate($page['rotation_angle']);
     515}
    486516
    487517// Crop & scale
     
    555585  $image->strip();
    556586}
     587
    557588$image->set_compression_quality( $params->quality );
    558589$image->write( $page['derivative_path'] );
Note: See TracChangeset for help on using the changeset viewer.