note 51112 deleted from function.imagecopy by googleguy
| From: | googleguy@php.net | Date: | Tue, 22 Oct 2013 10:16:50 +0000 |
| Subject: | note 51112 deleted from function.imagecopy by googleguy | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-196971@lists.php.net to get a copy of this message | ||
Note Submitter: slavo at polovnictvo-mn dot sk
----
<?
// **** 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 :-)