WeberDev.com PHP and MySQL Code

LOG IN
BEGINNER GUIDESPHP CLASSESCODE SEARCHARTICLES SEARCHPHP FORUMSPHP MANUALPHP FUNCTIONS LISTWEB SITE TEMPLATES
Start typing to search for PHP and MySQL Code Snippets and Articles Search


Submit a code Example / Snippet Join us on FaceBook
Submit a code Example / Snippet Submit Your Code
Search Engine Optimization Monitor SEO Monitor
Web Site UpTime Monitor UpTime Monitor
Your Personal Examples List My Favorite Examples
Your Personal Articles List My Favorite Articles
Edit Account Info Update Your Profile
PHP Code Search
Web Development Forums
Learn MySQL Playing Trivia
PHPBB2 Templates
Web Development Resources
Web Development Content
PHPClasses
PHP Editor
PHP Jobs
Vision.To Design
Ajax Tutorials
PHP Programming Help
PHP/MySQL Programming
Webmaster Resources
Webmaster Forum
XML meta language
website builder



Go Back Add a Comment Send this example to a friend Add this Article to your personal favoritest for easy future access to your favorite Code Examples and Articles. Submit a code example Print this code example.
BACK ADD A COMMENT SEND TO A FRIEND ADD TO MY FAVORITES ADD CODE EXAMPLES PRINT
Title : A Simple Function to write text on images !!!
Categories : PHP, GD image library, Graphics Click here to Update Your Picture
Vivek Ramnath
Date : Aug 13th 2004
Grade : 2 of 5 (graded 5 times)
Viewed : 15350
File : 3976.php
Images : No Images for this code example.
Search : More code by Vivek Ramnath
Action : Grade This Code Example
Tools : My Examples List

Submit your own code examples  Submit your own code examples 
 

This one of my new code snippet for the GD Library.
str_write("jpeg","abc/foo.jpg","ZEND");
str_write("png","abc/foo.png","ZEND");

<?php
function str_write($mime_type,$s_path,$string)
{
   if((
strcmp("jpeg",$mime_type)==0) ||( strcmp("jpg",$mime_type)==0))
   {
   
header("Content Type:image/jpeg");  // Set the mime type as jpeg
   
$im     = imagecreatefromjpeg($s_path);  //load the image
   
$orange = imagecolorallocate($im, 0, 0,255);  // pass the color of the font to be written
   
$px     = (imagesx($im) - 10.5 * strlen($string)) / 2//set the  X position of the string
   
$py     = imagesy($im) - 15 ;             //set the  Y position of the string
   
imagestring($im, 5, $px, $py, $string, $orange); //Write the string on the image
   
imagejpeg($im);  //Generate the jpeg image
   
return (imagejpeg($im));
   }
   else if(
strcmp("png",$mime_type)==0)
   {
   
header("Content Type:image/png");  // Set the mime type as jpeg
   
$im     = imagecreatefrompng($s_path); //load the image
   
$orange = imagecolorallocate($im, 0, 0,255); // pass the color of the font to be written
   
$px     = (imagesx($im) - 10.5 * strlen($string)) / 2; //set the  X position of the string
   
$py     = imagesy($im) - 15 //set the  Y position of the string
   
imagestring($im, 5, $px, $py, $string, $orange);  //Write the string on the image
   
imagepng($im);  //Generate the png image
   
return (imagepng($im));
   }
   else
     {
       print(
"<B>UNKNOWN MIME TYPE !!! </B>");
     }
}
?>




Display a bar chart based on random values.
Categories : Graphics, PHP, GD image library, Charts and Graphs
Generate image with random number (CAPTCHA)
Categories : PHP, GD image library, Graphics, Security
crop and resize image class using gd library function
Categories : PHP, PHP Classes, GD image library, Graphics
Simple class that uses GD to draw pie charts. After the class definition there's some sample code to demonstrate how you use the class.
Categories : Graphics, PHP, PHP Classes, GD image library, Charts and Graphs
Create a Thumbnail Using PHP, GD and Exif
Categories : PHP, Graphics, Exif, GD image library
PHP Email image generator - hide your email from bots - using the GD Library
Categories : PHP, Graphics, GD image library, Beginner Guides
Advanced Image WaterMarker
Categories : PHP, PHP Classes, GD image library, Graphics, Object Oriented
Image Generation Class ( PNG Format )
Categories : PHP, GD image library, PHP Classes, Graphics
Create Thumbnails - resize an image - jpeg, jpg, gif, png to the specifed width and height in proportion without loosing out on pixcel quality.
Categories : PHP, GD image library, Graphics
Simple PHP Bar Graph using GD library
Categories : PHP, GD image library, Graphics, Arrays
Line graphics generation library written in PHP + GD library (spanish comments)
Categories : PHP, Graphics, GD image library
A captcha image allows you to prevent spam posting when users reload the page and stop bots from submitting forms automatically. This version allows you to use your own fonts (.ttf) to show the text.
Categories : PHP, Security, Graphics, GD image library
EasyPhpThumbnail Class - The EasyPhpThumbnail class allows you to generate thumbnails and handle image manipulation for GIF, JPG and PNG on-the-fly.
Categories : PHP, PHP Classes, Object Oriented, Graphics, GD image library
PHP Image Compression using GD library
Categories : PHP, Compression, GD image library, Graphics
CAPTCHA[Image verification]
Categories : PHP, Security, GD image library, Graphics, Sessions