note 51112 added to function.imagecopy
| From: | slavoatpolovnictvo-mndotsk at osu1 dot php dot net | Date: | Sun, 20 Mar 2005 12:25:38 +0000 |
| Subject: | note 51112 added to function.imagecopy | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-86711@lists.php.net to get a copy of this message | ||
<?
// **** counting of width - START
// possible rating 0..5
$max_rating = 5;
$image_rating_width = 52;
$sirka_null = $image_rating_width / $max_rating * $_REQUEST['rating'];
// **** counting of width sirky - END
$rating = imagecreatetruecolor(52,12);
$nula = imagecreatefromjpeg("0.jpg");
$full = imagecreatefromjpeg("5.jpg");
imagecopy($rating, $full, 0, 0 , 0, 0, $sirka_null, 12);
imagecopy($rating, $nula, $sirka_null, 0 , $sirka_null, 0, (52-$sirka_null+1), 12);
header("Content-Type: image/jpeg");
imagejpeg($rating);
imagedestroy($rating);
exit;
?>
0.jpg is equal in size to 5.jpg (foe example 5 stars in image)
0.jpg has 0 filled stars as rating
5.jpg has 5 filled stars as rating
my images have size 52x12 px
You just put them together by imagecopy function :-)
----
Manual Page -- http://www.php.net/manual/en/function.imagecopy.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+51112
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+51112&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+51112&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+51112&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+51112&report=yes&reason=useless
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+51112&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+51112&report=yes
Search -- http://master.php.net/manage/user-notes.php