|
|
|
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. |
|
| 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 | | | Random Image Display Categories : PHP, Filesystem, Graphics, HTML and PHP | | | PHP Round Clock - Must have Gif support to use this. Categories : PHP, Date Time, Graphics | | | Creating thumbnails from MySQL Blobs online Categories : PHP, MySQL, Graphics, HTML and PHP, Databases | | | webcam cam view image ispy browser independant Categories : Graphics, HTML, HTML and PHP, PHP | | | Diffusion-Limited Aggregation visualization Categories : PHP, Graphics, Algorithms, Math. | | | Create images on fly using GD-Image Lib Categories : PHP, Graphics | | | This is a script that list all image files on a given directory, and displays
the thumbnails nicely formated within an HTML table. It also make use of
JavScript to open pop up windows when the users want to see the full photo. Categories : Graphics, PHP, Complete Programs, Java Script | | | Functions for loading images into a MySQL database and displaying them. Categories : Graphics, HTML and PHP, MySQL, PHP, Databases | | | Render TTF Text to PNG. Text message, font, size, rotation, padding, color, background, and transparency can all be defined via URL. Categories : PHP, PHP Classes, Graphics | | | Annual Bar Chart Categories : Graphics, PHP, Charts and Graphs | | | Display a bar chart based on random values. Categories : Graphics, PHP, GD image library, Charts and Graphs | | | This program implements hot link prevention in php. It is useful for webmasters who do not have access to the server at a level where they can control hot linking can still supply some type of hot link prevention for thier site by using php. Categories : PHP, Filesystem, Graphics, Content Management | | | Upload images restricted by pixel size (Picture width and Picture Height) Categories : PHP, HTML and PHP, Graphics | | | How to create charts for php using Rchart Categories : PHP, Java, JSP, Graphics, Charts and Graphs | |
|
|
|