Jump to content

Image redirect using php?


scuff

Recommended Posts

You cannot use the header function if output has already started or sent. If you visit page2.php directly it will redirect to example.com however embedding it in an HTML page will not work.

 

 

You may want to try

 

<meta http-equiv="refresh" content="0;url=http://example.com/">

Link to comment
Share on other sites

I tried putting <meta http-equiv="refresh" content="0;url=http://example"> on page2.php but it didn't work, so basically you can't redirect from img src, right?

Why are you even doing this? The image tag is for an image, if you didn't know, and the browser will only render it as so. If that would allow redirecting the bloody web would be 1000x as spammy than before.

 

Page2.php can redirect to http://www.example.com/image.jpg.

Link to comment
Share on other sites

lol good just making sure for security reasons on my site :P I'm trying to disable every possible way of redirecting

 

Only thing you'd need to watch out for is XSS, which relates to problems with javascript. The IMG tag will just output a resulting image if it is supported, such as mimetype image/jpg(gif/png/xmp/)

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.