In which the user's name will be on the black side in white letters & the rest of the strip has to become transaprent to view the picture.
It wil be merged with the original image(jpeg,png,gif).
Can any one help me?
phpmash
Moderator: General Moderators
What I want you to do is post an image where you have added the mark that you are requesting. Once I see that image I will know if it is possible to do with GD.phpmash wrote:Thanks for response.Here i have uploaded a pic
You add a strip in the bottom side with a text "cloning is great" (Right aligned).
The area where the text comes will be black and the rest of the strip wants to become transparent(to left side..)
http://www.upithere.com/view/1119.html
phpmash
Blimey!phpmash wrote:I expect the code

Code: Select all
function SpeedStripWatermark($image, $text = NULL, $destination = NULL)
{
# customisation section
$corner = 3; # distance from bottom right corner diagonally. value in pixels.
$padding = 3; # padding between text and text background in pixels
$font = 5; # 1 thru 5
$textcolor = array('red' => 255, 'green' => 255, 'blue' => 255); # 0 thru 255
$transColor = array('red' => 0, 'green' => 0, 'blue' => 0); # 0 thru 255
$quality = 75; # for Jpegs: 0 = worst, 100 = best
$text = ($text) ? $text : $_SERVER['HTTP_HOST'];
$fade_rate = 0.975; # float: 0 thru 1
# now lets build the image
$details = @getimagesize($image) or die("I cannot open $image");
$type = preg_replace('@^.+(?<=/)(.+)$@', '$1', $details['mime']);
eval('$image = imagecreatefrom'.$type.'($image);');
$imageHeight = $details[1];
$imageWidth = $details[0];
$textWidth = (strlen($text) * ImageFontWidth($font)) + ($padding * 2);
$textHeight = ImageFontHeight($font) + ($padding / 2);
$textcolor = imagecolorallocate($image, $textcolor['red'], $textcolor['green'], $textcolor['blue']);
$transparancyColor = imagecolorallocate($image, $transColor['red'],
$transColor['green'], $transColor['blue']);
imagefilledrectangle($image, ($x1 = round($imageWidth - $textWidth - $corner)), ($y1 = round($imageHeight - $textHeight - $corner)),
($x2 = round($imageWidth - $corner)), ($y2 = round($imageHeight - $corner)), $transparancyColor);
$bar = imagecreatetruecolor(1, round($y2 - $y1));
$transparancyColor = imagecolorallocate($bar, $transColor['red'],
$transColor['green'], $transColor['blue']);
imagefilledrectangle($bar, 0, 0, round($y2 - $y1), 1, $transparancyColor);
$pct = 100;
while($x1)
{
imagecopymerge($image, $bar, $x1--, $y1, 0, 0, 1, ($y2 - $y1)+1, ($pct = $pct * $fade_rate));
}
imagestring($image, $font, ($imageWidth - $textWidth - $corner) + $padding + 2,
($imageHeight - $textHeight - $corner) + ($padding / 4), $text, $textcolor);
$destination or header('Content-Type: '.$details['mime']);
eval('image'.$type.'($image'.(($type=='jpeg')?',$destination,$quality':($destination?',$destination':'')).');');
imagedestroy($image);
imagedestroy($bar);
$destination or die;
}