Image batching in php

Image Catching in php simple method.


<?php
$im = imagecreatefrompng("bmarker.png"); // img you chose
//The numbers are the RGB values of the color you want to use
//$textcolor = imagecolorallocatealpha($im,255,255,255,127);
$textcolor = imagecolorallocate($im, 0, 0, 0); // 4 peratmenter text color on image you want
//The canvas's (0,0) position is the upper left corner
//So this is how far down and to the right the text should start
$text = $i; // right text on it
$fromright = 11; // padding from right
$fromtop = 27; // padding from top
$fontsize = 10; // from size
$fonttype = 'arial.ttf'; // !importent
$rotate = 0; // rotate your text
/* for 1 to 9
$start_x = 18;
$start_y = 27;
*/
// for 10 to 99
//$start_x = 14;
//$start_y = 27;
/*
// for 100 to 999
$start_x = 11;
$start_y = 27;
*/
//This writes your text on the image in 12 point using verdana.ttf
//For the type of effects you quoted, you'll want to use a truetype font
//And not one of GD's built in fonts. Just upload the ttf file from your
//c: windows fonts directory to your web server to use it.
imagettftext($im, $fontsize, $rotate, $fromright, $fromtop, $textcolor, $fonttype, $text); // 8 peramenter
//Creates the jpeg image and sends it to the browser
//100 is the jpeg quality percentage
imagealphablending($im,false);
imagesavealpha($im,true);
imagepng($im, 'gimg/CB/'.$i.'.png'); // image name & where to save
imagedestroy($im); // the end
?>

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s