Jump to content

Recommended Posts

I'm a complete newbie to php and I'm trying to make a webcam .jpg image  on my server into a hyperlink to a page on another of my sites.

I've made a php file on the server where the image is located with the following code and called it imagem.php.  The webcam picture is being uploaded to the root, public_html/webcam2.jpg  This is the code I've used

 

?php
<a href="http://www.apartmentsspain.co.uk/documents/la_cala_de_finestrat_webcam.php" img src='.webcam2.jpg'</a>
 ?>

 

This doesn't work but when I open the file here http://www.holidaycottagegetaways.com/imagem.php  I get the link but I can't seem to get the correct syntax for the image path.  I've tried various things for the img src but I'm obviously going wrong somewhere. Can somebody point me in the right direction?

 

This is the image url http://www.holidaycottagegetaways.com/webcam2.jpg

 

The reason I want to do this is because a lot of sites have started using my webcam pic without linking back to my site so I've put a caption on the webcam pic with the url but it isn't a link.  If I can get this working, I'll change the caption on the pic to click here for live view. 

 

Any help would be appreciated.

Link to comment
https://forums.phpfreaks.com/topic/282559-creating-image-link/
Share on other sites

Thanks for the quick reply.

 

Sorry, that doesn't put a link on my webcam picture.  Not sure if I've explained this very well.

 

I've got a webcam program which ftp's a jpg file every 30 seconds to my server.  A lot of sites have copied the live source of the webcam jpg and are using it on their own websites without my permission and not linking back to me.  I need to make the webcam jpg into a hyperlink so that the picture is linking back to my site so it becomes a link whichever site it is being used on.  I think this is possible but I need a way of telling the server that the jpg is a hyperlink,  I hope I've explained it a bit better. 

Link to comment
https://forums.phpfreaks.com/topic/282559-creating-image-link/#findComment-1451852
Share on other sites

You wont be able to turn the image into a link, as images requested with <img /> the browser is expecting an image to be returned not html. But what you can do is check if the request for the image is from your site, by checking the HTTP_REFERER header. If it doesn't match serve a different image which will say something like "See my webcam at http://yourdomain.com".

 

This is called anti image hot linking. Search google for this term and there be some php examples of this.

Edited by Ch0cu3r
Link to comment
https://forums.phpfreaks.com/topic/282559-creating-image-link/#findComment-1451859
Share on other sites

In order for an image to display on a webpage you need to use the html image tag (<img src="path/to/image" />).

 

If they are doing this then you cannot make the image a link. You can only display an image with the <img /> tag, not render html.

 

When someone links to an image on another website without your consent this is called image hot linking. 

You will want to search google for anti image hotlinking techniques to stop them seeing the image and tell them to go to your website instead.

Link to comment
https://forums.phpfreaks.com/topic/282559-creating-image-link/#findComment-1451943
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.