Ejemplo n.º 1
0
 static function zoom($picture, $file_name = array('zoom_test.png', '../picture/zoom/'), $length, $is_height = false)
 {
     $image = palette::open($picture);
     $start_width = palette::info($image, 'width');
     $start_height = palette::info($image, 'height');
     $end_width = $length;
     $end_height = round($start_height * $end_width / $start_width);
     if ($is_height) {
         $end_width = round($start_width * $length / $start_height);
         $end_height = $length;
     }
     $canvas = palette::create($end_width, $end_height, 'ffffff', true);
     $param = array(0, 0, 0, 0, $end_width, $end_height, $start_width, $start_height);
     palette::copy($canvas, $image, $param, 4);
     palette::save($canvas, $file_name[0], $file_name[1]);
     return $file_name[1] . $file_name[0];
 }