Witam
Mam ogromna prosbe...
Pracuje nad porzygotowanie skelpu OSC (oscommerce) i zainstalowalem kontrybucje do kompresji i zmnijszania wielkosci plikow graficznych.
Mam problem poniewaz nei wiem gdize ustawic jakosc kompresji (np w przypadku jpeg na 60-70) poniewaz ta domyslna jest niska i jakosc jest do niczego.
Czy w ogole da sie to tu ustawic?
Oto caly skrypt
<?php
function thumbimage ($image, $x, $y, $aspectratio, $resize, $cachedir){
/*##############################################
# - Thumbnail-Script v1.3 - #
# Generating thumbnails 'on-the-fly' with php #
# #
# (c) by Christian Lamine, FlashDreams OHG #
# http://www.flashdreams.de/ #
# #
# Modified by http://www.tse.at #
# Modified by lars@iwer.de #
# #
# This script may be freely used, distributed #
# and modified without any charge as long as #
# this copyright information is included. #
# #
# Any commercial selling of this script is #
# forbidden. #
# #
# The author is not responsible for possible #
# damage which may result from the application #
# of this script, neither direct nor indirect. #
# Use at your own risk! #
##############################################*/
$types = array (1 => \"gif\", \"jpeg\", \"png\", \"swf\", \"psd\", \"wbmp\"); $not_supported_formats = array (\"\"); // Write in capital Letters!! ?
mkdir ($cachedir, 0777
) : system (\"chmod 0777 \".$cachedir);
(!isset ($x) || ereg ('^[0-9]{1,}$', $x, $regs)) && (!isset ($y) || ereg ('^[0-9]{1,}$', $y, $regs)) && ? true
: DIE ('Fehlende(r) oder ungültige(r) Größenparameter!');
!isset ($resize) || !ereg ('^[0|1]$', $resize, $regs) ? $resize = 0
: $resize;
!isset ($aspectratio) || !ereg ('^[0|1]$', $aspectratio, $regs) ? $aspectratio = 1
: $aspectratio = 0
: $aspectratio;
?
DIE ('Nie zadeklarowano zadnego obrazka!') ?
DIE ('Nie mozna bylo odnalesc pliku na serwerze!') : false;
!$imagedata[2] || $imagedata[2] == 4 || $imagedata[2] == 5
?
DIE ('Podczas pracy wykryto zly rodzaj pliku!') : false;
$imgtype=\"!(ImageTypes() & IMG_\" . strtoupper($types[$imagedata[2]]) . \")\";
$image = substr ($image, (strrpos (DIR_FS_CATALOG
. '/', '/'))+1
); return $image;
}
if (!isset ($x)) $x = floor ($y * $imagedata[0
] / $imagedata[1
]);
if (!isset ($y)) $y = floor ($x * $imagedata[1
] / $imagedata[0
]);
if ((($imagedata[1]/$y) > ($imagedata[0]/$x) )){
$x=ceil(($imagedata[0
]/$imagedata[1
])* $y); } else {
$y=ceil($x/($imagedata[0
]/$imagedata[1
])); }
}
$thumbdata[0] == $x && $thumbdata[1] == $y
? $iscached = true
: $iscached = false;
} else {
$iscached = false;
}
if (!$iscached) {
($imagedata[0] > $x || $imagedata[1] > $y) || (($imagedata[0] < $x || $imagedata[1] < $y) && $resize)
? $makethumb = true
: $makethumb = false;
} else {
$makethumb = false;
}
if ($makethumb) {
$image = call_user_func(\"imagecreatefrom\".$types[$imagedata[2]], $image);
if (function_exists(\"imagecreatetruecolor\") && ($thumb = imagecreatetruecolor ($x, $y))) {
imagecopyresampled ($thumb, $image, 0, 0, 0, 0, $x, $y, $imagedata[0], $imagedata[1]);
} else {
$thumb = imagecreate ($x, $y);
imagecopyresized ($thumb, $image, 0, 0, 0, 0, $x, $y, $imagedata[0], $imagedata[1]);
}
call_user_func(\"image\".$types[$imagedata[2]], $thumb, $cachedir.$thumbfile);
imagedestroy ($image);
imagedestroy ($thumb);
$image = DIR_WS_IMAGES . 'imagecache' . $thumbfile;
} else {
$iscached
? $image = DIR_WS_IMAGES . 'imagecache' . $thumbfile
: $image = substr ($image, (strrpos (DIR_FS_CATALOG
. '/', '/'))+1
); }
return $image;
}
?>
Chcialem popytac na forum tworcy skryptu ale niestety moj niemiecki nie jest lepszy od opanowania j. chińskiego przez 90 % Polakow (IMG:
http://forum.php.pl/style_emoticons/default/winksmiley.jpg)