Board index   FAQ   Search  
Register  Login
Board index php forum :: php coding PHP coding => Images

Create and Output multiple images that are clickable

images php coding issues or problems here.

Moderators: macek, egami, gesf

Create and Output multiple images that are clickable

Postby coderneeded » Tue Oct 01, 2013 8:59 am

The following script puts the text "Send Mails" on a green button image that I have. What I want to do is have multiple buttons created that are clickable and drive the user to certain pages.

greenbutton text = Send Emails when clicked user goes to email.php
redbutton text = Potential when clicked user goes to potential.php
bluebutton text = Bookings when clicked user goes to booking.php

I have attempted to create 3 different instances of imagejpeg($jpg_image);
imagejpeg($jpg_image1); imagejpeg($jpg_image2); imagejpeg($jpg_image2);

but it only shows the first one and have not figured out how to make them clickable.

Thanks,

Kurt

Code: Select all
<?php
      header('Content-type: image/jpg');

      $jpg_image = imagecreatefromjpeg('greenbutton.jpg');
         
      $color = imagecolorallocate($jpg_image, 0, 0, 0);

      $font_path = 'arial.ttf';

      $text = "Send Emails";

      imagettftext($jpg_image, 25, 0, 69, 60, $color, $font_path, $text);

     imagejpeg($jpg_image);
    
      imagedestroy($jpg_image);
    
?>
coderneeded
New php-forum User
New php-forum User
 
Posts: 31
Joined: Mon Mar 28, 2011 7:52 am

Re: Create and Output multiple images that are clickable

Postby coderneeded » Wed Oct 02, 2013 5:41 am

This is how I fix my issue:

I create a php file for each button color...just changing the image name, text for image, and made adjustments with these numbers 75, 55 to manually center the text.


1greenbutton.php
Code: Select all
<?php
     header('Content-type: image/jpg');
      $jpg_image = imagecreatefromjpeg('greenbutton.jpg');
      $color = imagecolorallocate($jpg_image, 0, 0, 0);
      $font_path = 'arial.ttf';
      $text = "Email / Edit";
      imagettftext($jpg_image, 25, 0, 75, 55, $color, $font_path, $text);
      imagejpeg($jpg_image);    
      imagedestroy($jpg_image);    
?>


I then added another php file to render them all

status.php

Code: Select all
<?php
echo "<img src='1green.php' width='350' height='90'>";
echo "<img src='1red.php' width='350' height='90'>";
echo "<img src='1blue.php' width='350' height='90'>";
echo "<img src='1grey.php' width='350' height='90'>";
?>


Kurt
coderneeded
New php-forum User
New php-forum User
 
Posts: 31
Joined: Mon Mar 28, 2011 7:52 am

Re: Create and Output multiple images that are clickable

Postby johnj » Wed Oct 02, 2013 6:25 am

So, what is the new issue?
johnj
php-forum Super User
php-forum Super User
 
Posts: 1805
Joined: Thu Mar 10, 2011 5:07 pm


Return to PHP coding => Images

Who is online

Users browsing this forum: No registered users and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.

cron