natasha_thomas Posted December 3, 2010 Share Posted December 3, 2010 Folks, I need help (Php code ) to generate a Dynamic Text on a Base Image. What i want to do is, to make this Image as header on my Site and to make this Header Specific to a Site, i want to Add the Domain Name on the Lower Left of the Image. Got the Idea? Here is the Image link: http://img27.imageshack.us/i/shoppingheader1.jpg/ PHP Variable that holds the Domain name is: $domain All i need the Dynamic PHP Codes that i can put on all my sites to generate this Text on Image (Header) Dynamically... May Anyone Help me with this Please? Cheers Natasha T. Link to comment https://forums.phpfreaks.com/topic/220530-dynamic-text-on-an-image-to-make-dynamic-headers/ Share on other sites More sharing options...
MasterACE14 Posted December 3, 2010 Share Posted December 3, 2010 <?php // headers header('Cache-Control: no-cache'); header('Pragma: no-cache'); header("Content-Type: image/jpeg"); // generate image $image = "http://img27.imageshack.us/i/shoppingheader1.jpg"; $font = 'DarkCrystal.ttf'; // can just download a free true type font (.ttf) $img = imagecreatefromjpeg($image); // create jpeg image from URL supplied // workout colors $black = ImageColorAllocate($img, 0, 0, 0); // black $red = ImageColorAllocate($img, 255, 0, 0); // red $white = ImageColorAllocate($img, 255, 255, 255); // white $TextColor = $black; // use black as the text color // http://au.php.net/manual/en/function.imagettftext.php // array imagettftext ( resource $image , float $size , float $angle , int $x , int $y , int $color , string $fontfile , string $text ) imagettftext ( $img , 12 , 0 , 15 , 15 , $TextColor , $font , $domain ); // create the image Imagejpeg($img,'',1); ImageDestroy($img); ?> Link to comment https://forums.phpfreaks.com/topic/220530-dynamic-text-on-an-image-to-make-dynamic-headers/#findComment-1142504 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.