-1

I have an image and I want to have a link on it. When someone clicks on the link they go to the given website. Is it possible to do so ?

clarifying my question

I am uploading an image and need a link in it

4
  • 1
    What are you uploading to? What have you tried? Will a standard web page work? Are you just sending a regular image to someone through email, mms, sms, what? Commented Jun 30, 2015 at 2:02
  • 1
    Is this within some software or in a webpage? For webpages, it's as easy as tagging it <a href="whatever.com"><img src="picture.jpg"></a>. If it's in software, then the method will be specific to that software. Commented Jun 30, 2015 at 3:31
  • 1
    I clearly stated that I wanted to upload an image to submit an application but at the same time I thought about a link inside an image itself. Thanks for down voting at least give an explanation. It is a sudden idea so I asked if it is possible or not. Like down voting? why then use this website if community can't explain and be friendly ?
    – Durdona A.
    Commented Jun 30, 2015 at 5:14
  • ... Think of the security risk?
    – Dave
    Commented Dec 5, 2017 at 18:53

4 Answers 4

3

There are no common image formats that, when viewed, will automatically go to a website via a click.

You can create a small web page in HTML that will reference the image and go to another page (or site) when the image is clicked.

The code for that page will look like this:

<a href="Title"><img src="image.png"></a>

Alternatively, you can create an SVG file, which is a type of vector graphics file. They can have links in them, but they are not standard raster images.

Another thing you can do is create a Flash animation consisting of only a static image. When clicked, it can direct to another website. Flash is not an image format, however.

5
  • that is not a solution since I am uploading an image
    – Durdona A.
    Commented Jun 29, 2015 at 23:58
  • 2
    Sorry, what you want is not possible with any common image formats. Commented Jun 29, 2015 at 23:59
  • yeah I hear that again sometimes things what I want are almost not possible to accomplish :) thank you anyway
    – Durdona A.
    Commented Jun 30, 2015 at 0:00
  • 1
    You're welcome. Another thing you can do is create a Flash animation consisting of only a static image. When clicked, it can direct to another website. Flash is not an image format, however. Commented Jun 30, 2015 at 0:02
  • 1
    I wonder if it's possible with SVG images.
    – user373230
    Commented Jun 30, 2015 at 0:35
0

Reading this article made me learn that it possible with SVG images.

For instance, you can create an image of a clickable rectangle that can lead to your website:

<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">

<a xlink:href="HTTP://YOURSITEGOESHERE.COM" target="_top">

<rect x="10" y="20" width="75" height="30" style="stroke: #333366; fill: #6666cc"/>

</a>

</svg>

Copy and paste the code into a text editor and save as a .svg file and open the file in a web browser.

5
  • how can I actually make it ?
    – Durdona A.
    Commented Jun 30, 2015 at 1:35
  • can u give step by step instructions?
    – Durdona A.
    Commented Jun 30, 2015 at 1:36
  • I edited the post. SVG files are rendered by web browsers. You can upload the file to be viewed in a browser or any other SVG viewer.
    – user373230
    Commented Jun 30, 2015 at 1:41
  • but it would let me save a rectangle in SVG format not the actual image what I wanted ...
    – Durdona A.
    Commented Jun 30, 2015 at 1:47
  • 1
    I believe there is no way to have a link on JPEG, PNG or other image format
    – Durdona A.
    Commented Jun 30, 2015 at 1:48
0

I am not familiar with any common image format that has links in its spec... Apart from SVG, which is vector graphics.

In an SVG you can link using <a> element. Here's an example:

<svg width="140" height="30"
     xmlns="http://www.w3.org/2000/svg" 
     xmlns:xlink="http://www.w3.org/1999/xlink">

  <a xlink:href="https://developer.mozilla.org/en-US/docs/SVG"
     target="_blank">
    <rect height="30" width="120" y="0" x="0" rx="15"/>
    <text fill="white" text-anchor="middle" 
          y="21" x="60">SVG on MDN</text>
  </a>

</svg>

You can also embed a raster image using <image> element and base64 encoded image data, then make it a link as per above. However, it might just be that whatever service you want to upload the image to has it restricted to formats like JPEG/PNG/GIF and won't accept SVG.

Otherwise, if you want a link stored and working in JPEG, PNG, BMP or GIF, then that's AFAIK not possible, as it's simply not in their specs.

1
  • @alpha check out the added info about <image> element. That's pretty much the closest to what you want - self-contained image file with a link inside. I don't know whether whatever service you want to upload the image to will accept SVG though.
    – Xupicor
    Commented Jun 30, 2015 at 7:19
-1

I think you may be looking for the image map feature of HTML. You can use it either to define various areas of an image to be treated as links, or request that the browser report the location of the click on the image as query-parameters when following it. This won't work if you're unable to supply the necessary HTML, though.

Formats other than simple images - objects such as SWF, SVG, IFRAMEd pagelets, Java applets and so forth - would be needed to carry the additional information necessary to embed a link.

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .