retab image.php (use vim, convert tabs to space)

This commit is contained in:
towards-a-new-leftypol 2024-12-22 05:24:27 +00:00
parent e9020ed17f
commit f78bf4c036
1 changed files with 445 additions and 445 deletions

View File

@ -8,98 +8,98 @@ defined('TINYBOARD') or exit;
require_once 'inc/polyfill.php'; require_once 'inc/polyfill.php';
class Image { class Image {
public $src, $format, $image, $size; public $src, $format, $image, $size;
public function __construct($src, $format = false, $size = false) { public function __construct($src, $format = false, $size = false) {
global $config; global $config;
$this->src = $src; $this->src = $src;
$this->format = $format; $this->format = $format;
if ($config['thumb_method'] == 'imagick') { if ($config['thumb_method'] == 'imagick') {
$classname = 'ImageImagick'; $classname = 'ImageImagick';
} elseif (in_array($config['thumb_method'], array('convert', 'convert+gifsicle', 'gm', 'gm+gifsicle'))) { } elseif (in_array($config['thumb_method'], array('convert', 'convert+gifsicle', 'gm', 'gm+gifsicle'))) {
$classname = 'ImageConvert'; $classname = 'ImageConvert';
} else { } else {
$classname = 'Image' . strtoupper($this->format); $classname = 'Image' . strtoupper($this->format);
if (!class_exists($classname)) { if (!class_exists($classname)) {
error(_('Unsupported file format: ') . $this->format); error(_('Unsupported file format: ') . $this->format);
} }
} }
$this->image = new $classname($this, $size); $this->image = new $classname($this, $size);
if (!$this->image->valid()) { if (!$this->image->valid()) {
$this->delete(); $this->delete();
error($config['error']['invalidimg4']); error($config['error']['invalidimg4']);
} }
$this->size = (object)array('width' => $this->image->_width(), 'height' => $this->image->_height()); $this->size = (object)array('width' => $this->image->_width(), 'height' => $this->image->_height());
if ($this->size->width < 1 || $this->size->height < 1) { if ($this->size->width < 1 || $this->size->height < 1) {
$this->delete(); $this->delete();
error($config['error']['invalidimg5']); error($config['error']['invalidimg5']);
} }
} }
public function resize($extension, $max_width, $max_height) { public function resize($extension, $max_width, $max_height) {
global $config; global $config;
if ($config['thumb_method'] == 'imagick') { if ($config['thumb_method'] == 'imagick') {
$classname = 'ImageImagick'; $classname = 'ImageImagick';
} elseif ($config['thumb_method'] == 'convert') { } elseif ($config['thumb_method'] == 'convert') {
$classname = 'ImageConvert'; $classname = 'ImageConvert';
} elseif ($config['thumb_method'] == 'convert+gifsicle') { } elseif ($config['thumb_method'] == 'convert+gifsicle') {
$classname = 'ImageConvert'; $classname = 'ImageConvert';
$gifsicle = true; $gifsicle = true;
} elseif ($config['thumb_method'] == 'gm') { } elseif ($config['thumb_method'] == 'gm') {
$classname = 'ImageConvert'; $classname = 'ImageConvert';
$gm = true; $gm = true;
} elseif ($config['thumb_method'] == 'gm+gifsicle') { } elseif ($config['thumb_method'] == 'gm+gifsicle') {
$classname = 'ImageConvert'; $classname = 'ImageConvert';
$gm = true; $gm = true;
$gifsicle = true; $gifsicle = true;
} else { } else {
$classname = 'Image' . strtoupper($extension); $classname = 'Image' . strtoupper($extension);
if (!class_exists($classname)) { if (!class_exists($classname)) {
error(_('Unsupported file format: ') . $extension); error(_('Unsupported file format: ') . $extension);
} }
} }
$thumb = new $classname(false); $thumb = new $classname(false);
$thumb->src = $this->src; $thumb->src = $this->src;
$thumb->format = $this->format; $thumb->format = $this->format;
$thumb->original_width = $this->size->width; $thumb->original_width = $this->size->width;
$thumb->original_height = $this->size->height; $thumb->original_height = $this->size->height;
$x_ratio = $max_width / $this->size->width; $x_ratio = $max_width / $this->size->width;
$y_ratio = $max_height / $this->size->height; $y_ratio = $max_height / $this->size->height;
if (($this->size->width <= $max_width) && ($this->size->height <= $max_height)) { if (($this->size->width <= $max_width) && ($this->size->height <= $max_height)) {
$width = $this->size->width; $width = $this->size->width;
$height = $this->size->height; $height = $this->size->height;
} elseif (($x_ratio * $this->size->height) < $max_height) { } elseif (($x_ratio * $this->size->height) < $max_height) {
$height = ceil($x_ratio * $this->size->height); $height = ceil($x_ratio * $this->size->height);
$width = $max_width; $width = $max_width;
} else { } else {
$width = ceil($y_ratio * $this->size->width); $width = ceil($y_ratio * $this->size->width);
$height = $max_height; $height = $max_height;
} }
$thumb->_resize($this->image->image, $width, $height); $thumb->_resize($this->image->image, $width, $height);
return $thumb; return $thumb;
} }
public function to($dst) { public function to($dst) {
$this->image->to($dst); $this->image->to($dst);
} }
public function delete() { public function delete() {
file_unlink($this->src); file_unlink($this->src);
} }
public function destroy() { public function destroy() {
$this->image->_destroy(); $this->image->_destroy();
} }
} }
class ImageGD { class ImageGD {
@ -111,234 +111,234 @@ class ImageGD {
public $original_height; public $original_height;
public $format; public $format;
public function GD_create() { public function GD_create() {
$this->image = imagecreatetruecolor($this->width, $this->height); $this->image = imagecreatetruecolor($this->width, $this->height);
} }
public function GD_copyresampled() { public function GD_copyresampled() {
imagecopyresampled($this->image, $this->original, 0, 0, 0, 0, $this->width, $this->height, $this->original_width, $this->original_height); imagecopyresampled($this->image, $this->original, 0, 0, 0, 0, $this->width, $this->height, $this->original_width, $this->original_height);
} }
public function GD_resize() { public function GD_resize() {
$this->GD_create(); $this->GD_create();
$this->GD_copyresampled(); $this->GD_copyresampled();
} }
} }
class ImageBase extends ImageGD { class ImageBase extends ImageGD {
public $image, $src, $original, $original_width, $original_height, $width, $height; public $image, $src, $original, $original_width, $original_height, $width, $height;
public function __construct($img, $size = false) { public function __construct($img, $size = false) {
if (method_exists($this, 'init')) if (method_exists($this, 'init'))
$this->init(); $this->init();
if ($size && $size[0] > 0 && $size[1] > 0) { if ($size && $size[0] > 0 && $size[1] > 0) {
$this->width = $size[0]; $this->width = $size[0];
$this->height = $size[1]; $this->height = $size[1];
}
if ($img !== false) {
$this->src = $img->src;
$this->from();
}
}
public function valid() {
return (bool)$this->image;
}
public function _width() {
if (method_exists($this, 'width'))
return $this->width();
// use default GD functions
return imagesx($this->image);
}
public function _height() {
if (method_exists($this, 'height'))
return $this->height();
// use default GD functions
return imagesy($this->image);
}
public function _destroy() {
if (method_exists($this, 'destroy'))
return $this->destroy();
// use default GD functions
return imagedestroy($this->image);
}
public function _resize($original, $width, $height) {
$this->original = &$original;
$this->width = $width;
$this->height = $height;
if (method_exists($this, 'resize')) {
$this->resize();
} else {
// use default GD functions
$this->GD_resize();
} }
}
if ($img !== false) {
$this->src = $img->src;
$this->from();
}
}
public function valid() {
return (bool)$this->image;
}
public function _width() {
if (method_exists($this, 'width'))
return $this->width();
// use default GD functions
return imagesx($this->image);
}
public function _height() {
if (method_exists($this, 'height'))
return $this->height();
// use default GD functions
return imagesy($this->image);
}
public function _destroy() {
if (method_exists($this, 'destroy'))
return $this->destroy();
// use default GD functions
return imagedestroy($this->image);
}
public function _resize($original, $width, $height) {
$this->original = &$original;
$this->width = $width;
$this->height = $height;
if (method_exists($this, 'resize')) {
$this->resize();
} else {
// use default GD functions
$this->GD_resize();
}
}
} }
class ImageImagick extends ImageBase { class ImageImagick extends ImageBase {
public function init() { public function init() {
$this->image = new Imagick(); $this->image = new Imagick();
$this->image->setBackgroundColor(new ImagickPixel('transparent')); $this->image->setBackgroundColor(new ImagickPixel('transparent'));
} }
public function from() { public function from() {
try { try {
$this->image->readImage($this->src); $this->image->readImage($this->src);
} catch(ImagickException $e) { } catch(ImagickException $e) {
// invalid image // invalid image
$this->image = false; $this->image = false;
} }
} }
public function to($src) { public function to($src) {
global $config; global $config;
if ($config['strip_exif']) { if ($config['strip_exif']) {
$this->image->stripImage(); $this->image->stripImage();
} }
if (preg_match('/\.gif$/i', $src)) { if (preg_match('/\.gif$/i', $src)) {
$this->image->writeImages($src, true); $this->image->writeImages($src, true);
} }
else { else {
$this->image->writeImage($src); $this->image->writeImage($src);
} }
} }
public function width() { public function width() {
return $this->image->getImageWidth(); return $this->image->getImageWidth();
} }
public function height() { public function height() {
return $this->image->getImageHeight(); return $this->image->getImageHeight();
} }
public function destroy() { public function destroy() {
return $this->image->destroy(); return $this->image->destroy();
} }
public function resize() { public function resize() {
global $config; global $config;
if ($this->format == 'gif' && ($config['thumb_ext'] == 'gif' || $config['thumb_ext'] == '')) { if ($this->format == 'gif' && ($config['thumb_ext'] == 'gif' || $config['thumb_ext'] == '')) {
$this->image = new Imagick(); $this->image = new Imagick();
$this->image->setFormat('gif'); $this->image->setFormat('gif');
$keep_frames = array(); $keep_frames = array();
for ($i = 0; $i < $this->original->getNumberImages(); $i += floor($this->original->getNumberImages() / $config['thumb_keep_animation_frames'])) { for ($i = 0; $i < $this->original->getNumberImages(); $i += floor($this->original->getNumberImages() / $config['thumb_keep_animation_frames'])) {
$keep_frames[] = $i; $keep_frames[] = $i;
} }
$i = 0; $i = 0;
$delay = 0; $delay = 0;
foreach ($this->original as $frame) { foreach ($this->original as $frame) {
$delay += $frame->getImageDelay(); $delay += $frame->getImageDelay();
if (in_array($i, $keep_frames)) { if (in_array($i, $keep_frames)) {
// $frame->scaleImage($this->width, $this->height, false); // $frame->scaleImage($this->width, $this->height, false);
$frame->sampleImage($this->width, $this->height); $frame->sampleImage($this->width, $this->height);
$frame->setImagePage($this->width, $this->height, 0, 0); $frame->setImagePage($this->width, $this->height, 0, 0);
$frame->setImageDelay($delay); $frame->setImageDelay($delay);
$delay = 0; $delay = 0;
$this->image->addImage($frame->getImage()); $this->image->addImage($frame->getImage());
} }
$i++; $i++;
} }
} else { } else {
$this->image = clone $this->original; $this->image = clone $this->original;
$this->image->scaleImage($this->width, $this->height, false); $this->image->scaleImage($this->width, $this->height, false);
} }
} }
} }
class ImageConvert extends ImageBase { class ImageConvert extends ImageBase {
public $width, $height, $temp, $gm = false, $gifsicle = false; public $width, $height, $temp, $gm = false, $gifsicle = false;
public function init() { public function init() {
global $config; global $config;
if ($config['thumb_method'] == 'gm' || $config['thumb_method'] == 'gm+gifsicle') if ($config['thumb_method'] == 'gm' || $config['thumb_method'] == 'gm+gifsicle')
$this->gm = true; $this->gm = true;
if ($config['thumb_method'] == 'convert+gifsicle' || $config['thumb_method'] == 'gm+gifsicle') if ($config['thumb_method'] == 'convert+gifsicle' || $config['thumb_method'] == 'gm+gifsicle')
$this->gifsicle = true; $this->gifsicle = true;
$this->temp = false; $this->temp = false;
} }
public function get_size($src, $try_gd_first = true) { public function get_size($src, $try_gd_first = true) {
if ($try_gd_first) { if ($try_gd_first) {
if ($size = @getimagesize($src)) if ($size = @getimagesize($src))
return $size; return $size;
} }
$size = shell_exec_error(($this->gm ? 'gm ' : '') . 'identify -format "%w %h" ' . escapeshellarg($src . '[0]')); $size = shell_exec_error(($this->gm ? 'gm ' : '') . 'identify -format "%w %h" ' . escapeshellarg($src . '[0]'));
if (preg_match('/^(\d+) (\d+)$/', $size, $m)) if (preg_match('/^(\d+) (\d+)$/', $size, $m))
return array($m[1], $m[2]); return array($m[1], $m[2]);
return false; return false;
} }
public function from() { public function from() {
if ($this->width > 0 && $this->height > 0) { if ($this->width > 0 && $this->height > 0) {
$this->image = true; $this->image = true;
return; return;
} }
$size = $this->get_size($this->src, false); $size = $this->get_size($this->src, false);
if ($size) { if ($size) {
$this->width = $size[0]; $this->width = $size[0];
$this->height = $size[1]; $this->height = $size[1];
$this->image = true; $this->image = true;
} else { } else {
// mark as invalid // mark as invalid
$this->image = false; $this->image = false;
} }
} }
public function to($src) { public function to($src) {
global $config; global $config;
if (!$this->temp) { if (!$this->temp) {
if ($config['strip_exif']) { if ($config['strip_exif']) {
if($error = shell_exec_error(($this->gm ? 'gm ' : '') . 'convert ' . if($error = shell_exec_error(($this->gm ? 'gm ' : '') . 'convert ' .
escapeshellarg($this->src) . ' -auto-orient -strip ' . escapeshellarg($src))) { escapeshellarg($this->src) . ' -auto-orient -strip ' . escapeshellarg($src))) {
$this->destroy(); $this->destroy();
error(_('Failed to redraw image!'), null, $error); error(_('Failed to redraw image!'), null, $error);
} }
} else { } else {
if($error = shell_exec_error(($this->gm ? 'gm ' : '') . 'convert ' . if($error = shell_exec_error(($this->gm ? 'gm ' : '') . 'convert ' .
escapeshellarg($this->src) . ' -auto-orient ' . escapeshellarg($src))) { escapeshellarg($this->src) . ' -auto-orient ' . escapeshellarg($src))) {
$this->destroy(); $this->destroy();
error(_('Failed to redraw image!'), null, $error); error(_('Failed to redraw image!'), null, $error);
} }
} }
} else { } else {
rename($this->temp, $src); rename($this->temp, $src);
chmod($src, 0664); chmod($src, 0664);
} }
} }
public function width() { public function width() {
return $this->width; return $this->width;
} }
public function height() { public function height() {
return $this->height; return $this->height;
} }
public function destroy() { public function destroy() {
@unlink($this->temp); @unlink($this->temp);
$this->temp = false; $this->temp = false;
} }
// Returns true if there is a real error and false if it's just a warning // Returns true if there is a real error and false if it's just a warning
// (appilcable to the return text of the `gm convert` command only) // (appilcable to the return text of the `gm convert` command only)
@ -358,71 +358,71 @@ class ImageConvert extends ImageBase {
return True; return True;
} }
public function resize() { public function resize() {
global $config; global $config;
if ($this->temp) { if ($this->temp) {
// remove old // remove old
$this->destroy(); $this->destroy();
} }
$this->temp = tempnam($config['tmp'], 'convert') . ($config['thumb_ext'] == '' ? '' : '.' . $config['thumb_ext']); $this->temp = tempnam($config['tmp'], 'convert') . ($config['thumb_ext'] == '' ? '' : '.' . $config['thumb_ext']);
$config['thumb_keep_animation_frames'] = (int)$config['thumb_keep_animation_frames']; $config['thumb_keep_animation_frames'] = (int)$config['thumb_keep_animation_frames'];
if ($this->format == 'gif' && ($config['thumb_ext'] == 'gif' || $config['thumb_ext'] == '') && $config['thumb_keep_animation_frames'] > 1) { if ($this->format == 'gif' && ($config['thumb_ext'] == 'gif' || $config['thumb_ext'] == '') && $config['thumb_keep_animation_frames'] > 1) {
if ($this->gifsicle) { if ($this->gifsicle) {
if (($error = shell_exec("gifsicle -w --unoptimize -O2 --resize {$this->width}x{$this->height} < " . if (($error = shell_exec("gifsicle -w --unoptimize -O2 --resize {$this->width}x{$this->height} < " .
escapeshellarg($this->src . '') . " \"#0-{$config['thumb_keep_animation_frames']}\" -o " . escapeshellarg($this->src . '') . " \"#0-{$config['thumb_keep_animation_frames']}\" -o " .
escapeshellarg($this->temp))) || !file_exists($this->temp)) { escapeshellarg($this->temp))) || !file_exists($this->temp)) {
$this->destroy(); $this->destroy();
error(_('Failed to resize image!'), null, $error); error(_('Failed to resize image!'), null, $error);
} }
} else { } else {
if ($config['convert_manual_orient'] && ($this->format == 'jpg' || $this->format == 'jpeg')) if ($config['convert_manual_orient'] && ($this->format == 'jpg' || $this->format == 'jpeg'))
$convert_args = str_replace('-auto-orient', ImageConvert::jpeg_exif_orientation($this->src), $config['convert_args']); $convert_args = str_replace('-auto-orient', ImageConvert::jpeg_exif_orientation($this->src), $config['convert_args']);
elseif ($config['convert_manual_orient']) elseif ($config['convert_manual_orient'])
$convert_args = str_replace('-auto-orient', '', $config['convert_args']); $convert_args = str_replace('-auto-orient', '', $config['convert_args']);
else else
$convert_args = &$config['convert_args']; $convert_args = &$config['convert_args'];
if (($error = shell_exec_error(($this->gm ? 'gm ' : '') . 'convert ' . if (($error = shell_exec_error(($this->gm ? 'gm ' : '') . 'convert ' .
sprintf($convert_args, sprintf($convert_args,
$this->width, $this->width,
$this->height, $this->height,
escapeshellarg($this->src), escapeshellarg($this->src),
$this->width, $this->width,
$this->height, $this->height,
escapeshellarg($this->temp)))) || !file_exists($this->temp)) { escapeshellarg($this->temp)))) || !file_exists($this->temp)) {
$this->destroy(); $this->destroy();
error(_('Failed to resize image!'), null, $error); error(_('Failed to resize image!'), null, $error);
} }
if ($size = $this->get_size($this->temp)) { if ($size = $this->get_size($this->temp)) {
$this->width = $size[0]; $this->width = $size[0];
$this->height = $size[1]; $this->height = $size[1];
} }
} }
} else { } else {
if ($config['convert_manual_orient'] && ($this->format == 'jpg' || $this->format == 'jpeg')) if ($config['convert_manual_orient'] && ($this->format == 'jpg' || $this->format == 'jpeg'))
$convert_args = str_replace('-auto-orient', ImageConvert::jpeg_exif_orientation($this->src), $config['convert_args']); $convert_args = str_replace('-auto-orient', ImageConvert::jpeg_exif_orientation($this->src), $config['convert_args']);
elseif ($config['convert_manual_orient']) elseif ($config['convert_manual_orient'])
$convert_args = str_replace('-auto-orient', '', $config['convert_args']); $convert_args = str_replace('-auto-orient', '', $config['convert_args']);
else else
$convert_args = &$config['convert_args']; $convert_args = &$config['convert_args'];
$full_convert_cmd = $full_convert_cmd =
($this->gm ? 'gm ' : '') . 'convert ' . ($this->gm ? 'gm ' : '') . 'convert ' .
sprintf( sprintf(
$convert_args, $convert_args,
$this->width, $this->width,
$this->height, $this->height,
escapeshellarg($this->src . '[0]'), escapeshellarg($this->src . '[0]'),
$this->width, $this->width,
$this->height, $this->height,
escapeshellarg($this->temp) escapeshellarg($this->temp)
); );
if (($error = shell_exec_error($full_convert_cmd)) || !file_exists($this->temp)) { if (($error = shell_exec_error($full_convert_cmd)) || !file_exists($this->temp)) {
if (ImageConvert::actualErrorOrJustWarning($error)) { if (ImageConvert::actualErrorOrJustWarning($error)) {
$this->destroy(); $this->destroy();
error(_('Failed to resize image!')." "._('Details: ').nl2br(htmlspecialchars($error)), null, array('convert_error' => $error)); error(_('Failed to resize image!')." "._('Details: ').nl2br(htmlspecialchars($error)), null, array('convert_error' => $error));
@ -432,125 +432,125 @@ class ImageConvert extends ImageBase {
$this->destroy(); $this->destroy();
error(_('Failed to resize image!'), null, $error); error(_('Failed to resize image!'), null, $error);
} }
} }
if ($size = $this->get_size($this->temp)) { if ($size = $this->get_size($this->temp)) {
$this->width = $size[0]; $this->width = $size[0];
$this->height = $size[1]; $this->height = $size[1];
} }
} }
} }
// For when -auto-orient doesn't exist (older versions) // For when -auto-orient doesn't exist (older versions)
static public function jpeg_exif_orientation($src, $exif = false) { static public function jpeg_exif_orientation($src, $exif = false) {
if (!$exif) { if (!$exif) {
$exif = @exif_read_data($src); $exif = @exif_read_data($src);
if (!isset($exif['Orientation'])) if (!isset($exif['Orientation']))
return false; return false;
} }
switch($exif['Orientation']) { switch($exif['Orientation']) {
case 1: case 1:
// Normal // Normal
return false; return false;
case 2: case 2:
// 888888 // 888888
// 88 // 88
// 8888 // 8888
// 88 // 88
// 88 // 88
return '-flop'; return '-flop';
case 3: case 3:
// 88 // 88
// 88 // 88
// 8888 // 8888
// 88 // 88
// 888888 // 888888
return '-flip -flop'; return '-flip -flop';
case 4: case 4:
// 88 // 88
// 88 // 88
// 8888 // 8888
// 88 // 88
// 888888 // 888888
return '-flip'; return '-flip';
case 5: case 5:
// 8888888888 // 8888888888
// 88 88 // 88 88
// 88 // 88
return '-rotate 90 -flop'; return '-rotate 90 -flop';
case 6: case 6:
// 88 // 88
// 88 88 // 88 88
// 8888888888 // 8888888888
return '-rotate 90'; return '-rotate 90';
case 7: case 7:
// 88 // 88
// 88 88 // 88 88
// 8888888888 // 8888888888
return '-rotate "-90" -flop'; return '-rotate "-90" -flop';
case 8: case 8:
// 8888888888 // 8888888888
// 88 88 // 88 88
// 88 // 88
return '-rotate "-90"'; return '-rotate "-90"';
} }
} }
} }
class ImagePNG extends ImageBase { class ImagePNG extends ImageBase {
public function from() { public function from() {
$this->image = @imagecreatefrompng($this->src); $this->image = @imagecreatefrompng($this->src);
} }
public function to($src) { public function to($src) {
global $config; global $config;
imagepng($this->image, $src); imagepng($this->image, $src);
} }
public function resize() { public function resize() {
$this->GD_create(); $this->GD_create();
imagecolortransparent($this->image, imagecolorallocatealpha($this->image, 0, 0, 0, 0)); imagecolortransparent($this->image, imagecolorallocatealpha($this->image, 0, 0, 0, 0));
imagesavealpha($this->image, true); imagesavealpha($this->image, true);
imagealphablending($this->image, false); imagealphablending($this->image, false);
$this->GD_copyresampled(); $this->GD_copyresampled();
} }
} }
class ImageGIF extends ImageBase { class ImageGIF extends ImageBase {
public function from() { public function from() {
$this->image = @imagecreatefromgif($this->src); $this->image = @imagecreatefromgif($this->src);
} }
public function to($src) { public function to($src) {
imagegif ($this->image, $src); imagegif ($this->image, $src);
} }
public function resize() { public function resize() {
$this->GD_create(); $this->GD_create();
imagecolortransparent($this->image, imagecolorallocatealpha($this->image, 0, 0, 0, 0)); imagecolortransparent($this->image, imagecolorallocatealpha($this->image, 0, 0, 0, 0));
imagesavealpha($this->image, true); imagesavealpha($this->image, true);
$this->GD_copyresampled(); $this->GD_copyresampled();
} }
} }
class ImageJPG extends ImageBase { class ImageJPG extends ImageBase {
public function from() { public function from() {
$this->image = @imagecreatefromjpeg($this->src); $this->image = @imagecreatefromjpeg($this->src);
} }
public function to($src) { public function to($src) {
imagejpeg($this->image, $src); imagejpeg($this->image, $src);
} }
} }
class ImageJPEG extends ImageJPG { class ImageJPEG extends ImageJPG {
@ -558,11 +558,11 @@ class ImageJPEG extends ImageJPG {
class ImageBMP extends ImageBase { class ImageBMP extends ImageBase {
public function from() { public function from() {
$this->image = @imagecreatefrombmp($this->src); $this->image = @imagecreatefrombmp($this->src);
} }
public function to($src) { public function to($src) {
imagebmp($this->image, $src); imagebmp($this->image, $src);
} }
} }