473,795 Members | 2,746 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

PHP Image functions -- help

Hello,

Could anyone throw some light on the following questions, please?

1) How can I add a hyperlink to an image file generated using GD
library?
For eg., I'm using ImageString(... ) function to add text to a JPEG
image. I want to make that text an hyperlink.

2) How do I insert another gif/jpeg image into an image generated using
GD library?
For eg., I've the following code......I want to include "test.gif" into
the generated JPEG (something like <img src=''> in html)

header("Content-Type: image/jpeg");
$c = ImageCreate($cw , $ch);
:
:
ImageFilledRect angle(....)
ImageRectangle( ....)
ImageString(... .)
:
:
ImageJPEG($c);
TIA,
Hemanth

Apr 3 '06 #1
1 2837
NC
Hemanth wrote:

Could anyone throw some light on the following questions, please?

1) How can I add a hyperlink to an image file generated using GD
library?
For eg., I'm using ImageString(... ) function to add text to a JPEG
image. I want to make that text an hyperlink.
You can't. What you can do is to figure out what area of the image the
text occupies and define that area as a hyperlink using an image map
(image maps are defined in HTML). But you will have to do it OUTSIDE
the script that generates the image.
2) How do I insert another gif/jpeg image into an image generated
using GD library?


1. Create a new image with imagecreate().
2. Read the existing gif/jpeg image using imagecreatefrom gif()/
imagecreatefrom jpeg().
3. Copy that image into the one you are working on using
imagecopy().
4. Output the new image.

For more information, refer to the PHP Manual:

http://www.php.net/imagecreate
http://www.php.net/imagecreatefromgif
http://www.php.net/imagecreatefromjpeg
http://www.php.net/imagecopy

Cheers,
NC

Apr 3 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
2009
by: Useko Netsumi | last post by:
Hi, suppose I'd like to convert my JPG images(in a directory) into a lower resolution and uniform size(while maintaining its aspect ratio), I would I do that in PHP? I've seen code with PHP/GD but can't yet figure out how to do it and apply the result into a new name. Thanks
5
2611
by: news | last post by:
Hi, I am pretty new to PHP I want to do the following but I have been unable to find good info/ or sample code on it; please help; - retrieve a gif/jpeg image using PHP from another site - using PHP code I want to edit the image by superimposing a smaller image on the lower right hand corner
9
2805
by: Chris Jankowski | last post by:
Hi all, I am still new to using Python, so bare with me. I am trying to call a DLL from my program to use some of it's functions. The only parameter is supposed to be a pointer to an image. I have tried several variations on passing this parameter to the DLL and I am not having much luck. This is going to call other functions later for OCR, but I want to get a simple one working first. Here is my code: (Very basic)
8
2615
by: Jef Driesen | last post by:
I'm implementing some image processing algorithms in C++. I created a class called 'image' (see declaration below), that will take care of the memory allocations and some basic (mathematical) stuff. The class will behave like a std::vector (copy constructor and assignment create a deep copy), but with 2D indexing. Now I also need a 'view' class that will behave like a reference to an 'image' (can only be constructed from an existing...
2
2147
by: cjl | last post by:
Hey all: I have a div of a known size, 672px X 672px. In it I will display images that are of unknown size. I have two simple functions that shrink and center the image: function shrink() { if (document.getElementById('right').height >= document.getElementById('right').width)
6
3321
by: QuasiChameleon | last post by:
Hi, I'm trying to create a grayscale image class that reads and writes grayscale Targa format. This works well with smaller images, but corrupts larger images and creates a "Segmentation fault (core dumped)" error. I am at a loss as to why this works only part of the time. I hope it's proper etiquette to post the code below (3 files). Can someone please show me what's wrong with the following code? I
0
1944
by: Crystal | last post by:
I have created a small program that prints out an organization chart in PHP using the GD lib's imagecreate, imageline and imagestring functions. Basically, a user selects an employee from a drop-down list to generate an on-the-fly graphical organization tree. A function is called to set the selected employee's data into an imagestring and draw imagelines around it. Next a recursive function is called to query for and display all direct...
8
2830
by: ctiggerf | last post by:
I was hopeing someone could help me out here. Been stumped on this one all day. This function 1. Checks uploaded files. 2. Creates two resized images from each (a full size, and a thumbnail). 3. Returns an array with a bool (false if the upload failed), and an error message.
12
2969
by: laredotornado | last post by:
Hi, I'm using PHP 5. I was wondering given an image, a.jpg, how can I make an image that would look like you slid a white index card (which I have a file, white.jpg with the same dimensions as a.jpg) over a.jpg? Note that you'd be sliding the image from top to bottom or from left to right, but not both. Thanks, let me know if this makes sense ... it's a litlte hard to describe.
36
2397
by: vimal3271 | last post by:
I want to know how to read image files in C.. what are the headers that i should include? is there any tutorials regarding this ? pls inform me.
1
10163
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9040
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7538
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6780
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5436
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5563
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4113
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3722
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2920
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.