I think you should set the compression/quality as a variable (maybe even one passed to the constructor) as 60% is not going to be acceptable to most designers. For a static value I'd reccommend 85% or even 90
I also have a thumbnailing class being distributed from most of the class distro sites and from
here.
Also note: rather than the mime_content_tyep and imagesx / imagesy calls, you could use getimagesize - the first index return is width, second is height and third is imagetype
so
- Code: Select all
$f_type = getimagesize($base_image);
$this->c_image = ($f_type[2] < 4)
? ($f_type[2] < 3)
? ($f_type[2] < 2)
? ($f_type[2] < 1) ?
NULL
: imagecreatefromgif($base_image)
: imagecreatefromjpeg($base_image)
: imagecreatefrompng($base_image)
: NULL;
if($this->c_image !== NULL)
{
// $f_type[0] is width
// $f_type[1] is height