/docs/MyDocs

To get this branch, use:
bzr branch http://darksoft.org/webbzr/docs/MyDocs

« back to all changes in this revision

Viewing changes to Web/php/php-images.txt

  • Committer: Suren A. Chilingaryan
  • Date: 2009-04-09 03:21:08 UTC
  • Revision ID: csa@dside.dyndns.org-20090409032108-w4edamdh4adrgdu3
import

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?php
 
2
    Header("Content-type: image/png");
 
3
    $string=implode($argv," ");
 
4
    $im = imageCreateFromPng("images/button1.png");
 
5
    $orange = ImageColorAllocate($im, 220, 210, 60);
 
6
    $px = (imagesx($im)-7.5*strlen($string))/2;
 
7
    ImageString($im,3,$px,9,$string,$orange);
 
8
    ImagePng($im);
 
9
    ImageDestroy($im);
 
10
?>
 
11
 
 
12
This example would be called from a page with a tag like: <img
 
13
src="button.php?text"> The above button.php script then takes this "text"
 
14
string an overlays it on top of a base image which in this case is
 
15
"images/button1.png" and outputs the resulting image. This is a very
 
16
convenient way to avoid having to draw new button images every time you want
 
17
to change the text of a button. With this method they are dynamically
 
18
generated.