PHP & OOP - Image_Thumbnails

Links for php scripts

Moderators: macek, egami, gesf

User avatar
Oleg Butuzov
Last Samuray
Last Samuray
Posts: 831
Joined: Sun Jun 02, 2002 3:09 am

PHP & OOP - Image_Thumbnails

Postby Oleg Butuzov » 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....=)

http://www.ua-design.net/blog/pear-image-thumbnails/

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

Postby pootergeist » 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

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

User avatar
Redcircle
Moderator
Moderator
Posts: 830
Joined: Tue Jan 21, 2003 10:42 pm
Location: Michigan USA
Contact:

Postby Redcircle » Fri Sep 05, 2003 3:28 pm

link is not working

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

Postby sigix » Fri Sep 05, 2003 10:35 pm

:arrow: link is working ...

User avatar
Oleg Butuzov
Last Samuray
Last Samuray
Posts: 831
Joined: Sun Jun 02, 2002 3:09 am

Postby Oleg Butuzov » Sat Sep 06, 2003 12:19 am

permanent link
http://www.ua-design.net/blog/04.09.2003

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


Return to “PHP Scripts”

Who is online

Users browsing this forum: No registered users and 0 guests