Changeset 26298 for extensions/header_manager/include/banner.class.php
- Timestamp:
- Dec 28, 2013, 6:08:42 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/header_manager/include/banner.class.php
r15854 r26298 1 1 <?php 2 if (!defined('HEADER_MANAGER_PATH'))die('Hacking attempt!');2 defined('HEADER_MANAGER_PATH') or die('Hacking attempt!'); 3 3 4 4 include_once(PHPWG_ROOT_PATH . 'admin/include/image.class.php'); … … 9 9 class banner_image extends pwg_image 10 10 { 11 function banner_resize($destination_filepath, $ x, $y, $x2, $y2, $width, $height)11 function banner_resize($destination_filepath, $selection) 12 12 { 13 13 global $conf; … … 18 18 $source_height = $this->image->get_height(); 19 19 20 $resize_dimensions = array( 21 'width' => $width, 22 'height'=> $height, 23 'crop' => array( 24 'width' => $x2-$x, 25 'height' => $y2-$y, 26 'x' => $x, 27 'y' => $y, 28 ), 20 $crop = array( 21 'width' => $selection['x2']-$selection['x'], 22 'height' => $selection['y2']-$selection['y'], 23 'x' => $selection['x'], 24 'y' => $selection['y'], 29 25 ); 30 26 31 // maybe resizing/crop ing is useless ?32 if ( $resize_dimensions['crop']['width'] == $source_width and $resize_dimensions['crop']['height'] == $source_height)27 // maybe resizing/cropping is useless ? 28 if ($conf['header_manager']['width'] == $source_width and $conf['header_manager']['height'] == $source_height) 33 29 { 34 30 // the image doesn't need any resize! We just copy it to the destination 35 31 copy($this->source_filepath, $destination_filepath); 36 return $this->get_resize_result($destination_filepath, $ resize_dimensions['width'], $resize_dimensions['height'], $starttime);32 return $this->get_resize_result($destination_filepath, $source_width, $source_height, $starttime); 37 33 } 38 34 … … 40 36 $this->image->strip(); 41 37 38 // crop 39 $this->image->crop($crop['width'], $crop['height'], $crop['x'], $crop['y']); 40 42 41 // resize to what is displayed on crop screen 43 if ($ source_width> $conf['header_manager']['width'])42 if ($crop['width'] > $conf['header_manager']['width']) 44 43 { 45 $this->image->resize($ resize_dimensions['width'], $source_height*$resize_dimensions['width']/$source_width);44 $this->image->resize($conf['header_manager']['width'], $crop['height']*$conf['header_manager']['width']/$crop['width']); 46 45 } 47 48 // crop49 $this->image->crop($resize_dimensions['crop']['width'], $resize_dimensions['crop']['height'], $resize_dimensions['crop']['x'], $resize_dimensions['crop']['y']);50 46 51 47 // save … … 53 49 54 50 // everything should be OK if we are here! 55 return $this->get_resize_result($destination_filepath, $ resize_dimensions['crop']['width'], $resize_dimensions['crop']['height'], $starttime);51 return $this->get_resize_result($destination_filepath, $crop['width'], $crop['height'], $starttime); 56 52 } 57 53 … … 69 65 } 70 66 } 71 72 ?>
Note: See TracChangeset
for help on using the changeset viewer.