PHP Developers Network

A community of PHP developers offering assistance, advice, discussion, and friendship.
 
Loading
It is currently Sat Dec 20, 2014 9:23 am

All times are UTC - 5 hours




Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: Mon Sep 29, 2008 7:12 am 
Offline
Forum Newbie

Joined: Mon Sep 29, 2008 2:36 am
Posts: 5
hi!
i m facing the Problem, i want transparent image of some width n height and text on that image...but when i m using
imageSaveAlpha($image, true);
ImageAlphaBlending($image, false); its not working...
so i had another code...
<?php

Header('Content-type: image/png');

//$size = 300;
//$Img=imagecreatetruecolor(100,30);

$Img = imagecreate(110,30);

$Gray = imagecolorallocatealpha($Img, 0, 0, 255, 10);

$text = 'Testing..';

imageFilledRectangle($Img,0,0,100,100,$Gray);
imagecolortransparent($Img,$Gray);

$font = 'Shelley_AllegroScript.ttf';
imagettftext($Img, 20, 0, 10, 20, $Gray, $font, $text);
//imagestring($Img,4,0,0,$text,$Gold);
//imagecolortransparent($Img,$Gray);

imagepng($Img);

ImageDestroy($Img);
?>
but i m getting diminished text....


Top
 Profile  
 
PostPosted: Wed Oct 01, 2008 6:23 am 
Offline
Forum Newbie

Joined: Wed Oct 01, 2008 4:32 am
Posts: 9
Location: Mumbai, India
Use this code..

$text = "Testing..";
// create the image

// use white as the background image
$image = imagecreate(100, 30);
$bgColor = imagecolorallocate($image, 255, 255, 255);


// the text color is black
$textColor = imagecolorallocate($image, 192, 82, 67);

// write the random number
imagestring ($image, 5, 5, 8, $text, $textColor);

// Date in the past
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");

// always modified
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");


header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);

header("Pragma: no-cache");

// send the content type header so the image is displayed properly
header('Content-type: image/png');

// send the image to the browser
imagepng($image);

// destroy the image to free up the memory
imagedestroy($image);


Top
 Profile  
 
PostPosted: Wed Oct 01, 2008 6:56 am 
Offline
Jedi Mod
User avatar

Joined: Tue Dec 21, 2004 6:03 pm
Posts: 5263
Location: usrlab.com
Where in that code will it be making the image transparent?


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group