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
Poker Tournaments Poker Tournaments
Poker Guide for Developers Poker Guide for Developers
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
Internet Security Software
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
פרייסז - הכח לקנות עובר לידיים שלך
Texas Holdem Poker Evangelists

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 : Writing on an Image using PHP.
Categories : PHP, Graphics Click here to Update Your Picture
Srikanth Turaga
Date : Aug 18th 2003
Grade : 3 of 5 (graded 8 times)
Viewed : 10763
File : 3722.zip
Images : No Images for this code example.
Search : More code by Srikanth Turaga
Action : Grade This Code Example
Tools : My Examples List

Submit your own code examples  Submit your own code examples 
 

Hi friends,

I had to develope a script where some text needed to written on a base image depending on the
session variables.

I have come up with a code that would give you an idea on the GDLib functionality of PHP. This is a
very basic example that helps you in creating a small application that would write to an image
(PNG).

Hope this helps someone.

Thank you,
Sri.

PSS: I don't think there should be any problem with the code, if incase you happen to find some
problem let me know. I'll be glad to help you.

imagedemo.html
~~~~~~~~~~~~~~

<HTML><BODY>
<FORM METHOD=POST ACTION=imagedemo.php>
<INPUT TYPE=text NAME=caption><BR>
<INPUT TYPE=Submit name=Submit>
</FORM>
</BODY></HTML>


imagedemo.php
~~~~~~~~~~~~~

<?php
    header
("Content-type: image/png");   
   
$string = $HTTP_POST_VARS['caption'];   
   
$im     = imagecreatefrompng("meditate.png");
   
$orange = imagecolorallocate($im, 220, 210, 60);
   
$px     = (imagesx($im) - 7.5 * strlen($string)) / 2;
   
imagestring($im, 9, $px, 9, $string, $orange);
   
imageline($im,$px,30,$px+9.0*strlen($string),30,3);
   
imagedashedline($im,$px,36,$px+9.0*strlen($string),36,3);
   
imagepng($im);
   
imagedestroy($im);
?>



The zip file that is downloadable has a PNG Image too in it.



GetImageSize -- Get the size of a GIF, JPEG, PNG or SWF image
Categories : PHP, PHP Functions, Graphics
HTML_Graphs provides a simple PHP interface for creating pure HTML charts.
Categories : Graphics, PHP, PHP Classes, Charts and Graphs
Create MRTG Graphic from rrd database (Need MRTG and RRDTool installed).
Categories : PHP, Network, Graphics
PHP Round Clock - Must have Gif support to use this.
Categories : PHP, Date Time, Graphics
Image Cache
Categories : Graphics, PHP Classes, PHP
Create a Thumbnail Using PHP, GD and Exif
Categories : PHP, Graphics, Exif, GD image library
Simple way of scaling any image to fit either given width or height.
Categories : PHP, Graphics, Arrays
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
img_upload - array img_upload(string 'form field name', string 'image name', string 'destination'); Returns an array with 2 elements. Index 0 contains the string name of the image. Index 1 contains the string path to the image.
Categories : Graphics, PHP
Three Cool Classes and One Trick
Categories : PHP, PHP Classes, Graphics, Email
PHP Email image generator - hide your email from bots - using the GD Library
Categories : PHP, Graphics, GD image library, Beginner Guides
Creating thumbnails from MySQL Blobs online
Categories : PHP, MySQL, Graphics, HTML and PHP, Databases
Diffusion-Limited Aggregation visualization
Categories : PHP, Graphics, Algorithms, Math.
A class to draw real 3D graphics with surface area
Categories : Graphics, PHP, PHP Classes
How to create charts for php using Rchart
Categories : PHP, Java, JSP, Graphics, Charts and Graphs