Jump to content

Using the GD to create an image within a PHP script!


chadrt

Recommended Posts

I am having issues with placing the following code within a full php script.  The output becomes unreadable.  However when I use it in a standalone script I experience no problems at all.

 

<?php
header ("Content-type: image/png");
$handle = ImageCreate (400, 25);
$bg_color = ImageColorAllocate ($handle, 255, 255, 255);
$txt_color = ImageColorAllocate ($handle, 0, 0, 0);
ImageString ($handle, 5, 2, 4, "joe.blow.someone@somefriggenemailaddy.com", $txt_color);
ImagePng ($handle);
?>

 

No matter what I do I cant seem to integrate it my script, whose output can be seen here: www.callsignmail.com you can use KI4MVE in the first search criteria box.  When I through that into the script it's output is not human readable it is converted into a bunch of very unreadable characters across the screen.  What I eventually hope to accomplish is to use it to show an email address stored in my database on the screen in an image format rather than text that can be seen by unscrupulous site searching robots and email harvesters.  Any help would be greatly appreciated.

 

 

Link to comment
Share on other sites

... use it like this:

 

<img src="my_gd_image_scriptname.php">   where my_gd_image_scriptname.php is the real name of the script to create the image.

 

The code snippet actually creates the image display for:

ImagePng ($handle);

 

If I were to use it in say a standalone script I would have to pass varriables to it before calling it.  I just tried that and it works, but is there a way to put all that in the same script maybe by replacing  the ImagePng ($handle) with something else so it acatually displays the image.  I dont know I am a rookie at PHP.

Link to comment
Share on other sites

Still looking for a way to use GD within my existing script.  The point here is to hide any text based entry of an email address in my scripts output wether that be in the browser or View Source.  I know that there are bots that search the internet every second of every day scanning pages and their server output.  While a varriable is hidden till it is echo'd a varriable placed into an < img > tag would not be as it would be placed in the server output.  I would like to take my email address and have it displayed as an image within an existing script.  I thank you so much to the person who pointed out to me the img tag was needed but unfortunately now that I know that is how you have to do that I need to find a way to do it differently.  I just dont want those robots to use my site as a place of harvesting.

 

I appreciate any help that could be sent my way, Thank YOU!!

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.