note 97926 added to function.getimagesize

From: Date: Sun, 16 May 2010 08:39:43 +0000
Subject: note 97926 added to function.getimagesize
Groups: php.notes 
Request: Send a blank email to php-notes+get-169303@lists.php.net to get a copy of this message
I wrote this functions to check, if a picture is bigger than a size, we need to define first ( $setting['thumb_breit'] ) if its bigger, we need to create a thumbnail, if not, just use the original-size note: create_thumb() is a ownmade funktion by ilch.de <?php # first we check, if gd is loaded and supports all needed imagetypes function gd_get_info() { if (extension_loaded('gd') and imagetypes() & IMG_PNG and imagetypes() & IMG_GIF and imagetypes() & IMG_JPG and imagetypes() & IMG_WBMP) { return true; } else { return false; } } /* This returns the width of a image What we need to know is that getimagesize() returns an array key 0 = image-width key 1 = image-height key 3 = both sizes as string */ function check_thumb_needed($img) { $bildsizes = getimagesize($img); $bildbreite = $bildsizes[0]; return $bildbreite; } $bildbr = check_thumb_needed($imgdir.$newname); if ($bildbr !== false && $bildbr > $setting['thumb_breit']) { create_thumb($imgdir.$newname, $thumbdir.'thumb_'.$newname, $setting['thumb_breit']); } else { create_thumb($imgdir.$newname, $thumbdir.'thumb_'.$newname, $bildbr); } ---- Server IP: 85.214.154.209 Probable Submitter: 92.193.75.23 ---- Manual Page -- http://www.php.net/manual/en/function.getimagesize.php Edit -- https://master.php.net/note/edit/97926 Del: integrated -- https://master.php.net/note/delete/97926/integrated Del: useless -- https://master.php.net/note/delete/97926/useless Del: bad code -- https://master.php.net/note/delete/97926/bad+code Del: spam -- https://master.php.net/note/delete/97926/spam Del: non-english -- https://master.php.net/note/delete/97926/non-english Del: in docs -- https://master.php.net/note/delete/97926/in+docs Del: other reasons-- https://master.php.net/note/delete/97926 Reject -- https://master.php.net/note/reject/97926 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#169303) next »