PHP & OOP - Image_Thumbnails

Links for php scripts

Moderators: egami, macek, gesf

Post Reply
Oleg Butuzov
Last Samuray
Last Samuray
Posts: 824
Joined: Sun Jun 02, 2002 3:09 am

Thu Sep 04, 2003 1:06 am

I have write a small class for creating Thumbnails. I hope its will help somebody.

Any quetions in blog please. I am sorry but didnt yet translate my blog to english =(. I hope this litlle troubles would disturb you....=)

New php-forum User
New php-forum User
Posts: 191
Joined: Wed Jan 29, 2003 7:11 am
Location: UK

Thu Sep 04, 2003 3:24 am

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


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) ?
                            : 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
avatar image based upon nasas apod (only updates if I post though)

User avatar
Posts: 826
Joined: Tue Jan 21, 2003 10:42 pm
Location: Michigan USA

Fri Sep 05, 2003 3:28 pm

link is not working

php-forum Active User
php-forum Active User
Posts: 364
Joined: Mon Jul 14, 2003 9:39 pm
Location: /Earth/Xion

Fri Sep 05, 2003 10:35 pm

:arrow: link is working ...

Oleg Butuzov
Last Samuray
Last Samuray
Posts: 824
Joined: Sun Jun 02, 2002 3:09 am

Sat Sep 06, 2003 12:19 am

permanent link

as for get image type by getimagesize function. I prefer to use mime_content_type() =)

Post Reply