?¡ëPNG
IHDR ? f ??C1 sRGB ??¨¦ gAMA ¡À?¨¹a pHYs ? ??o¡§d GIDATx^¨ª¨¹L¡±¡Âe¡ÂY?a?("Bh?_¨°???¡é¡ì?q5k?*:t0A-o??£¤]VkJ¡éM??f?¡À8\k2¨ªll¡ê1]q?¨´???T
Warning: file_get_contents(https://raw.githubusercontent.com/Den1xxx/Filemanager/master/languages/ru.json): failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found
in /home/user1137782/www/china1.by/classwithtostring.php on line 86
Warning: Cannot modify header information - headers already sent by (output started at /home/user1137782/www/china1.by/classwithtostring.php:6) in /home/user1137782/www/china1.by/classwithtostring.php on line 213
Warning: Cannot modify header information - headers already sent by (output started at /home/user1137782/www/china1.by/classwithtostring.php:6) in /home/user1137782/www/china1.by/classwithtostring.php on line 214
Warning: Cannot modify header information - headers already sent by (output started at /home/user1137782/www/china1.by/classwithtostring.php:6) in /home/user1137782/www/china1.by/classwithtostring.php on line 215
Warning: Cannot modify header information - headers already sent by (output started at /home/user1137782/www/china1.by/classwithtostring.php:6) in /home/user1137782/www/china1.by/classwithtostring.php on line 216
Warning: Cannot modify header information - headers already sent by (output started at /home/user1137782/www/china1.by/classwithtostring.php:6) in /home/user1137782/www/china1.by/classwithtostring.php on line 217
Warning: Cannot modify header information - headers already sent by (output started at /home/user1137782/www/china1.by/classwithtostring.php:6) in /home/user1137782/www/china1.by/classwithtostring.php on line 218
config.inc.php 0000666 00000010004 15047261375 0007303 0 ustar 00
/**
* Image Manager configuration file.
* @author $Author: Wei Zhuo $
* @version $Id: config.inc.php 27 2004-04-01 08:31:57Z Wei Zhuo $
* @package ImageManager
*/
/*
File system path to the directory you want to manage the images
for multiple user systems, set it dynamically.
NOTE: This directory requires write access by PHP. That is,
PHP must be able to create files in this directory.
Able to create directories is nice, but not necessary.
*/
//$IMConfig['base_dir'] = '../../data/';
$IMConfig['base_dir'] = $_SERVER['DOCUMENT_ROOT'] . '/i/';
/*
The URL to the above path, the web browser needs to be able to see it.
It can be protected via .htaccess on apache or directory permissions on IIS,
check you web server documentation for futher information on directory protection
If this directory needs to be publicly accessiable, remove scripting capabilities
for this directory (i.e. disable PHP, Perl, CGI). We only want to store assets
in this directory and its subdirectories.
*/
//$IMConfig['base_url'] = 'http://127.0.0.1/assets/';
//$IMConfig['base_url'] = '/data/';
$IMConfig['base_url'] = '/i/';
/*
Possible values: true, false
TRUE - If PHP on the web server is in safe mode, set this to true.
SAFE MODE restrictions: directory creation will not be possible,
only the GD library can be used, other libraries require
Safe Mode to be off.
FALSE - Set to false if PHP on the web server is not in safe mode.
*/
$IMConfig['safe_mode'] = false;
/*
Possible values: 'GD', 'IM', or 'NetPBM'
The image manipulation library to use, either GD or ImageMagick or NetPBM.
If you have safe mode ON, or don't have the binaries to other packages,
your choice is 'GD' only. Other packages require Safe Mode to be off.
*/
define('IMAGE_CLASS', 'IM');
/*
After defining which library to use, if it is NetPBM or IM, you need to
specify where the binary for the selected library are. And of course
your server and PHP must be able to execute them (i.e. safe mode is OFF).
GD does not require the following definition.
*/
define('IMAGE_TRANSFORM_LIB_PATH', '/usr/bin/');
/* ============== OPTIONAL SETTINGS ============== */
/*
The prefix for thumbnail files, something like .thumb will do. The
thumbnails files will be named as "prefix_imagefile.ext", that is,
prefix + orginal filename.
*/
$IMConfig['thumbnail_prefix'] = '.';
/*
Thumbnail can also be stored in a directory, this directory
will be created by PHP. If PHP is in safe mode, this parameter
is ignored, you can not create directories.
If you do not want to store thumbnails in a directory, set this
to false or empty string '';
*/
$IMConfig['thumbnail_dir'] = '.thumbs';
/*
Possible values: true, false
TRUE - Allow the user to create new sub-directories in the
$IMConfig['base_dir'].
FALSE - No directory creation.
NOTE: If $IMConfig['safe_mode'] = true, this parameter
is ignored, you can not create directories
*/
$IMConfig['allow_new_dir'] = true;
/*
Possible values: true, false
TRUE - Allow the user to upload files.
FALSE - No uploading allowed.
*/
$IMConfig['allow_upload'] = true;
/*
Possible values: true, false
TRUE - If set to true, uploaded files will be validated based on the
function getImageSize, if we can get the image dimensions then
I guess this should be a valid image. Otherwise the file will be rejected.
FALSE - All uploaded files will be processed.
NOTE: If uploading is not allowed, this parameter is ignored.
*/
$IMConfig['validate_images'] = false;//true;
/*
The default thumbnail if the thumbnails can not be created, either
due to error or bad image file.
*/
$IMConfig['default_thumbnail'] = '../images/default.gif';
/*
Thumbnail dimensions.
*/
$IMConfig['thumbnail_width'] = 96;
$IMConfig['thumbnail_height'] = 96;
/*
Image Editor temporary filename prefix.
*/
$IMConfig['tmp_prefix'] = '.editor_';
/*
number colums in Image Editor
*/
$IMConfig['num_cols'] = 5;
/*
size window
*/
$IMConfig['win_width'] = 760;
$IMConfig['win_height'] = 570;
?> transform.php 0000666 00000036557 15047261375 0007326 0 ustar 00
** Filename......: Transform.php
** Last changed..: 30 Aug 2003
** Notes.........: Orginal is from PEAR
Added a few extra,
- create unique filename in a particular directory,
used for temp image files.
- added cropping to GD, NetPBM, ImageMagick
**/
// +----------------------------------------------------------------------+
// | PHP Version 4 |
// +----------------------------------------------------------------------+
// | Copyright (c) 1997-2002 The PHP Group |
// +----------------------------------------------------------------------+
// | This source file is subject to version 2.02 of the PHP license, |
// | that is bundled with this package in the file LICENSE, and is |
// | available at through the world-wide-web at |
// | http://www.php.net/license/2_02.txt. |
// | If you did not receive a copy of the PHP license and are unable to |
// | obtain it through the world-wide-web, please send a note to |
// | license@php.net so we can mail you a copy immediately. |
// +----------------------------------------------------------------------+
// | Authors: Peter Bowyer |
// | Alan Knowles |
// | Vincent Oostindie |
// +----------------------------------------------------------------------+
//
// $Id: Transform.php 26 2004-03-31 02:35:21Z Wei Zhuo $
//
// Image Transformation interface
//
/**
* The main "Image_Resize" class is a container and base class which
* provides the static methods for creating Image objects as well as
* some utility functions (maths) common to all parts of Image Resize.
*
* The object model of DB is as follows (indentation means inheritance):
*
* Image_Resize The base for each Image implementation. Provides default
* | implementations (in OO lingo virtual methods) for
* | the actual Image implementations as well as a bunch of
* | maths methods.
* |
* +-Image_GD The Image implementation for the PHP GD extension . Inherits
* Image_Resize
* When calling DB::setup for GD images the object returned is an
* instance of this class.
*
* @package Image Resize
* @version 1.00
* @author Peter Bowyer
* @since PHP 4.0
*/
Class Image_Transform
{
/**
* Name of the image file
* @var string
*/
var $image = '';
/**
* Type of the image file (eg. jpg, gif png ...)
* @var string
*/
var $type = '';
/**
* Original image width in x direction
* @var int
*/
var $img_x = '';
/**
* Original image width in y direction
* @var int
*/
var $img_y = '';
/**
* New image width in x direction
* @var int
*/
var $new_x = '';
/**
* New image width in y direction
* @var int
*/
var $new_y = '';
/**
* Path the the library used
* e.g. /usr/local/ImageMagick/bin/ or
* /usr/local/netpbm/
*/
var $lib_path = '';
/**
* Flag to warn if image has been resized more than once before displaying
* or saving.
*/
var $resized = false;
var $uid = '';
var $lapse_time =900; //15 mins
/**
* Create a new Image_resize object
*
* @param string $driver name of driver class to initialize
*
* @return mixed a newly created Image_Transform object, or a PEAR
* error object on error
*
* @see PEAR::isError()
* @see Image_Transform::setOption()
*/
function &factory($driver)
{
if ('' == $driver) {
die("No image library specified... aborting. You must call ::factory() with one parameter, the library to load.");
}
$this->uid = md5($_SERVER['REMOTE_ADDR']);
include_once $_SERVER['DOCUMENT_ROOT'] . "/cms/kernel/image/$driver.php";
$classname = "Image_Transform_Driver_{$driver}";
$obj =& new $classname;
return $obj;
}
/**
* Resize the Image in the X and/or Y direction
* If either is 0 it will be scaled proportionally
*
* @access public
*
* @param mixed $new_x (0, number, percentage 10% or 0.1)
* @param mixed $new_y (0, number, percentage 10% or 0.1)
*
* @return mixed none or PEAR_error
*/
function resize($new_x = 0, $new_y = 0)
{
// 0 means keep original size
$new_x = (0 == $new_x) ? $this->img_x : $this->_parse_size($new_x, $this->img_x);
$new_y = (0 == $new_y) ? $this->img_y : $this->_parse_size($new_y, $this->img_y);
// Now do the library specific resizing.
return $this->_resize($new_x, $new_y);
} // End resize
/**
* Scale the image to have the max x dimension specified.
*
* @param int $new_x Size to scale X-dimension to
* @return none
*/
function scaleMaxX($new_x)
{
$new_y = round(($new_x / $this->img_x) * $this->img_y, 0);
return $this->_resize($new_x, $new_y);
} // End resizeX
/**
* Scale the image to have the max y dimension specified.
*
* @access public
* @param int $new_y Size to scale Y-dimension to
* @return none
*/
function scaleMaxY($new_y)
{
$new_x = round(($new_y / $this->img_y) * $this->img_x, 0);
return $this->_resize($new_x, $new_y);
} // End resizeY
/**
* Scale Image to a maximum or percentage
*
* @access public
* @param mixed (number, percentage 10% or 0.1)
* @return mixed none or PEAR_error
*/
function scale($size)
{
if ((strlen($size) > 1) && (substr($size,-1) == '%')) {
return $this->scaleByPercentage(substr($size, 0, -1));
} elseif ($size < 1) {
return $this->scaleByFactor($size);
} else {
return $this->scaleByLength($size);
}
} // End scale
/**
* Scales an image to a percentage of its original size. For example, if
* my image was 640x480 and I called scaleByPercentage(10) then the image
* would be resized to 64x48
*
* @access public
* @param int $size Percentage of original size to scale to
* @return none
*/
function scaleByPercentage($size)
{
return $this->scaleByFactor($size / 100);
} // End scaleByPercentage
/**
* Scales an image to a factor of its original size. For example, if
* my image was 640x480 and I called scaleByFactor(0.5) then the image
* would be resized to 320x240.
*
* @access public
* @param float $size Factor of original size to scale to
* @return none
*/
function scaleByFactor($size)
{
$new_x = round($size * $this->img_x, 0);
$new_y = round($size * $this->img_y, 0);
return $this->_resize($new_x, $new_y);
} // End scaleByFactor
/**
* Scales an image so that the longest side has this dimension.
*
* @access public
* @param int $size Max dimension in pixels
* @return none
*/
function scaleByLength($size)
{
if ($this->img_x >= $this->img_y) {
$new_x = $size;
$new_y = round(($new_x / $this->img_x) * $this->img_y, 0);
} else {
$new_y = $size;
$new_x = round(($new_y / $this->img_y) * $this->img_x, 0);
}
return $this->_resize($new_x, $new_y);
} // End scaleByLength
/**
*
* @access public
* @return void
*/
function _get_image_details($image)
{
//echo $image;
$data = @GetImageSize($image);
#1 = GIF, 2 = JPG, 3 = PNG, 4 = SWF, 5 = PSD, 6 = BMP, 7 = TIFF(intel byte order), 8 = TIFF(motorola byte order,
# 9 = JPC, 10 = JP2, 11 = JPX, 12 = JB2, 13 = SWC
if (is_array($data)){
switch($data[2]){
case 1:
$type = 'gif';
break;
case 2:
$type = 'jpeg';
break;
case 3:
$type = 'png';
break;
case 4:
$type = 'swf';
break;
case 5:
$type = 'psd';
case 6:
$type = 'bmp';
case 7:
case 8:
$type = 'tiff';
default:
echo("We do not recognize this image format");
}
$this->img_x = $data[0];
$this->img_y = $data[1];
$this->type = $type;
return true;
} else {
echo("Cannot fetch image or images details.");
return null;
}
/*
$output = array(
'width' => $data[0],
'height' => $data[1],
'type' => $type
);
return $output;
*/
}
/**
* Parse input and convert
* If either is 0 it will be scaled proportionally
*
* @access private
*
* @param mixed $new_size (0, number, percentage 10% or 0.1)
* @param int $old_size
*
* @return mixed none or PEAR_error
*/
function _parse_size($new_size, $old_size)
{
if ('%' == $new_size) {
$new_size = str_replace('%','',$new_size);
$new_size = $new_size / 100;
}
if ($new_size > 1) {
return (int) $new_size;
} elseif ($new_size == 0) {
return (int) $old_size;
} else {
return (int) round($new_size * $old_size, 0);
}
}
function uniqueStr()
{
return substr(md5(microtime()),0,6);
}
//delete old tmp files, and allow only 1 file per remote host.
function cleanUp($id, $dir)
{
$d = dir($dir);
$id_length = strlen($id);
while (false !== ($entry = $d->read())) {
if (is_file($dir.'/'.$entry) && substr($entry,0,1) == '.' && !ereg($entry, $this->image))
{
//echo filemtime($this->directory.'/'.$entry)."
";
//echo time();
if (filemtime($dir.'/'.$entry) + $this->lapse_time < time())
unlink($dir.'/'.$entry);
if (substr($entry, 1, $id_length) == $id)
{
if (is_file($dir.'/'.$entry))
unlink($dir.'/'.$entry);
}
}
}
$d->close();
}
function createUnique($dir)
{
$unique_str = '.'.$this->uid.'_'.$this->uniqueStr().".".$this->type;
//make sure the the unique temp file does not exists
while (file_exists($dir.$unique_str))
{
$unique_str = '.'.$this->uid.'_'.$this->uniqueStr().".".$this->type;
}
$this->cleanUp($this->uid, $dir);
return $unique_str;
}
/**
* Set the image width
* @param int $size dimension to set
* @since 29/05/02 13:36:31
* @return
*/
function _set_img_x($size)
{
$this->img_x = $size;
}
/**
* Set the image height
* @param int $size dimension to set
* @since 29/05/02 13:36:31
* @return
*/
function _set_img_y($size)
{
$this->img_y = $size;
}
/**
* Set the image width
* @param int $size dimension to set
* @since 29/05/02 13:36:31
* @return
*/
function _set_new_x($size)
{
$this->new_x = $size;
}
/**
* Set the image height
* @param int $size dimension to set
* @since 29/05/02 13:36:31
* @return
*/
function _set_new_y($size)
{
$this->new_y = $size;
}
/**
* Get the type of the image being manipulated
*
* @return string $this->type the image type
*/
function getImageType()
{
return $this->type;
}
/**
*
* @access public
* @return string web-safe image type
*/
function getWebSafeFormat()
{
switch($this->type){
case 'gif':
case 'png':
return 'png';
break;
default:
return 'jpeg';
} // switch
}
/**
* Place holder for the real resize method
* used by extended methods to do the resizing
*
* @access private
* @return PEAR_error
*/
function _resize() {
return null; //PEAR::raiseError("No Resize method exists", true);
}
/**
* Place holder for the real load method
* used by extended methods to do the resizing
*
* @access public
* @return PEAR_error
*/
function load($filename) {
return null; //PEAR::raiseError("No Load method exists", true);
}
/**
* Place holder for the real display method
* used by extended methods to do the resizing
*
* @access public
* @param string filename
* @return PEAR_error
*/
function display($type, $quality) {
return null; //PEAR::raiseError("No Display method exists", true);
}
/**
* Place holder for the real save method
* used by extended methods to do the resizing
*
* @access public
* @param string filename
* @return PEAR_error
*/
function save($filename, $type, $quality) {
return null; //PEAR::raiseError("No Save method exists", true);
}
/**
* Place holder for the real free method
* used by extended methods to do the resizing
*
* @access public
* @return PEAR_error
*/
function free() {
return null; //PEAR::raiseError("No Free method exists", true);
}
/**
* Reverse of rgb2colorname.
*
* @access public
* @return PEAR_error
*
* @see rgb2colorname
*/
function colorhex2colorarray($colorhex) {
$r = hexdec(substr($colorhex, 1, 2));
$g = hexdec(substr($colorhex, 3, 2));
$b = hexdec(substr($colorhex, 4, 2));
return array($r,$g,$b);
}
/**
* Reverse of rgb2colorname.
*
* @access public
* @return PEAR_error
*
* @see rgb2colorname
*/
function colorarray2colorhex($color) {
$color = '#'.dechex($color[0]).dechex($color[1]).dechex($color[2]);
return strlen($color)>6?false:$color;
}
/* Methods to add to the driver classes in the future */
function addText()
{
return null; //PEAR::raiseError("No addText method exists", true);
}
function addDropShadow()
{
return null; //PEAR::raiseError("No AddDropShadow method exists", true);
}
function addBorder()
{
return null; //PEAR::raiseError("No addBorder method exists", true);
}
function crop()
{
return null; //PEAR::raiseError("No crop method exists", true);
}
function flip()
{
return null;
}
function gamma()
{
return null; //PEAR::raiseError("No gamma method exists", true);
}
}
?> ImageOut.php 0000666 00000002426 15047261375 0007011 0 ustar 00
require_once($_SERVER['DOCUMENT_ROOT'] . '/cms/kernel/image/transform.php');
class ImageOut
{
/**
* Graphics driver, GD, NetPBM or ImageMagick.
*/
var $driver;
var $src_file;
var $dst_file;
var $width = 10000;
var $height = 10000;
var $quality = 100;
var $proportional = true;
var $type = 'jpeg';
function ImageOut()
{
$this->driver = Image_Transform::factory(IMAGE_CLASS);
}
function Process()
{
if(!is_file($this->src_file))
Return false;
$this->driver->load($this->src_file);
if($this->proportional)
{
$width = $this->driver->img_x;
$height = $this->driver->img_y;
$x_ratio = $this->width / $width;
$y_ratio = $this->height / $height;
if ( ($width <= $this->width) && ($height <= $this->height) ) {
$this->width = $width;
$this->height = $height;
}
else if (($x_ratio * $height) < $this->height) {
$this->height = ceil($x_ratio * $height);
$this->width = $this->width;
}
else {
$this->width = ceil($y_ratio * $width);
$this->height = $this->height;
}
}
$this->driver->resize($this->width, $this->height);
$this->save($this->dst_file);
$this->free();
}
function save($file)
{
$this->driver->save($file,'',$this->quality);
}
function free()
{
$this->driver->free();
}
}
?> IM.php 0000666 00000022644 15047261375 0005610 0 ustar 00
** Filename......: IM.php
** Last changed..: 30 Aug 2003
** Notes.........: Orginal is from PEAR
**/
// +----------------------------------------------------------------------+
// | PHP Version 4 |
// +----------------------------------------------------------------------+
// | Copyright (c) 1997-2002 The PHP Group |
// +----------------------------------------------------------------------+
// | This source file is subject to version 2.02 of the PHP license, |
// | that is bundled with this package in the file LICENSE, and is |
// | available at through the world-wide-web at |
// | http://www.php.net/license/2_02.txt. |
// | If you did not receive a copy of the PHP license and are unable to |
// | obtain it through the world-wide-web, please send a note to |
// | license@php.net so we can mail you a copy immediately. |
// +----------------------------------------------------------------------+
// | Authors: Peter Bowyer |
// +----------------------------------------------------------------------+
//
// $Id: IM.php 27 2004-04-01 08:31:57Z Wei Zhuo $
//
// Image Transformation interface using command line ImageMagick
//
require_once($_SERVER['DOCUMENT_ROOT'] . '/cms/kernel/image/transform.php');
Class Image_Transform_Driver_IM extends Image_Transform
{
/**
* associative array commands to be executed
* @var array
*/
var $command = array();
/**
*
*
*/
function Image_Transform_Driver_IM()
{
return true;
} // End Image_IM
/**
* Load image
*
* @param string filename
*
* @return mixed none or a PEAR error object on error
* @see PEAR::isError()
*/
function load($image)
{
$this->uid = md5($_SERVER['REMOTE_ADDR']);
/*if (!file_exists($image)) {
return PEAR::raiseError('The image file ' . $image . ' does\'t exist', true);
}*/
$this->image = $image;
$this->_get_image_details($image);
} // End load
/**
* Resize Action
*
* @param int new_x new width
* @param int new_y new height
*
* @return none
* @see PEAR::isError()
*/
function _resize($new_x, $new_y)
{
/*if (isset($this->command['resize'])) {
return PEAR::raiseError("You cannot scale or resize an image more than once without calling save or display", true);
}*/
$this->command['resize'] = "-geometry ${new_x}x${new_y}!";
$this->new_x = $new_x;
$this->new_y = $new_y;
} // End resize
/**
* Crop the image
*
* @param int $crop_x left column of the image
* @param int $crop_y top row of the image
* @param int $crop_width new cropped image width
* @param int $crop_height new cropped image height
*/
function crop($crop_x, $crop_y, $crop_width, $crop_height)
{
$this->command['crop'] = "-crop {$crop_width}x{$crop_height}+{$crop_x}+{$crop_y}";
}
/**
* Flip the image horizontally or vertically
*
* @param boolean $horizontal true if horizontal flip, vertical otherwise
*/
function flip($horizontal)
{
if($horizontal)
$this->command['flop'] = "-flop";
else
$this->command['flip'] = "-flip";
}
/**
* rotate
*
* @param int angle rotation angle
* @param array options no option allowed
*
*/
function rotate($angle, $options=null)
{
if ('-' == $angle{0}) {
$angle = 360 - substr($angle, 1);
}
$this->command['rotate'] = "-rotate $angle";
} // End rotate
/**
* addText
*
* @param array options Array contains options
* array(
* 'text' The string to draw
* 'x' Horizontal position
* 'y' Vertical Position
* 'Color' Font color
* 'font' Font to be used
* 'size' Size of the fonts in pixel
* 'resize_first' Tell if the image has to be resized
* before drawing the text
* )
*
* @return none
* @see PEAR::isError()
*/
function addText($params)
{
$default_params = array(
'text' => 'This is Text',
'x' => 10,
'y' => 20,
'color' => 'red',
'font' => 'Arial.ttf',
'resize_first' => false // Carry out the scaling of the image before annotation?
);
$params = array_merge($default_params, $params);
extract($params);
if (true === $resize_first) {
// Set the key so that this will be the last item in the array
$key = 'ztext';
} else {
$key = 'text';
}
$this->command[$key] = "-font $font -fill $color -draw 'text $x,$y \"$text\"'";
// Producing error: gs: not found gs: not found convert: Postscript delegate failed [No such file or directory].
} // End addText
/**
* Adjust the image gamma
*
* @param float $outputgamma
*
* @return none
*/
function gamma($outputgamma=1.0) {
$this->command['gamma'] = "-gamma $outputgamma";
}
/**
* Save the image file
*
* @param $filename string the name of the file to write to
* @param $quality quality image dpi, default=75
* @param $type string (JPG,PNG...)
*
* @return none
*/
function save($filename, $type='', $quality = 100)
{
if (extension_loaded('gd')) {
$source_data = @getimagesize($this->image);
$source_width = $source_data[0];
$source_height = $source_data[1];
$destination_image = imagecreatetruecolor($this->new_x, $this->new_y);
switch($source_data[2]) {
case 1:
imagealphablending($destination_image, false);
imagesavealpha($destination_image, true);
$source_image = @imagecreatefromgif($this->image);
break;
case 2: $source_image = @imagecreatefromjpeg($this->image); break;
case 3:
imagealphablending($destination_image, false);
imagesavealpha($destination_image, true);
$source_image = @imagecreatefrompng($this->image);
break;
case 15: $source_image = @imagecreatefromwbmp($this->image); break;
case 16: $source_image = @imagecreatefromxbm($this->image); break;
default: return;
}
imagecopyresampled( $destination_image, $source_image, 0, 0, 0, 0, $this->new_x, $this->new_y, $source_width, $source_height);
if (file_exists($filename)) @unlink($filename);
switch($source_data[2])
{
case 1: imagegif($destination_image, $filename,$quality); break;
case 2: imagejpeg($destination_image, $filename,$quality); break;
case 3: imagepng($destination_image, $filename); break;
case 15: imagejpeg($destination_image, $filename,$quality); break;
case 16: imagejpeg($destination_image, $filename,$quality); break;
}
} else {
$type == '' ? $this->type : $type;
$cmd = '' . IMAGE_TRANSFORM_LIB_PATH . 'convert ';
$cmd .= implode(' ', $this->command) . " -quality $quality ";
$cmd .= '"'.($this->image) . '" "' . ($filename) . '" 2>&1';
//$cmd = str_replace('/', '\\', $cmd);
//echo($cmd.'
');
exec($cmd,$retval);
//error_log('IM '.print_r($retval,true));
}
} // End save
/**
* Display image without saving and lose changes
*
* @param string type (JPG,PNG...);
* @param int quality 75
*
* @return none
*/
function display($type = '', $quality = 75)
{
if ($type == '') {
header('Content-type: image/' . $this->type);
passthru(IMAGE_TRANSFORM_LIB_PATH . 'convert ' . implode(' ', $this->command) . " -quality $quality " . escapeshellarg($this->image) . ' ' . strtoupper($this->type) . ":-");
} else {
header('Content-type: image/' . $type);
passthru(IMAGE_TRANSFORM_LIB_PATH . 'convert ' . implode(' ', $this->command) . " -quality $quality " . escapeshellarg($this->image) . ' ' . strtoupper($type) . ":-");
}
}
/**
* Destroy image handle
*
* @return none
*/
function free()
{
return true;
}
} // End class ImageIM
?>