Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Redirected IMG Tag

Options
  • 16-12-2012 7:31pm
    #1
    Closed Accounts Posts: 2,301 ✭✭✭


    Quick question,

    Lets say there's an image hosted at "example.com/image1"
    and lets say that if I go to "redirect.com/image1" which has no images, it redirects me to "example.com/image1" after 1 second

    If I use an image tag, <img src=redirect.com/image1(>)
    Is there anyway to force a browser to wait for redirect.com/image1 to redirect to example.com/image1?(where the image is stored) and then fetch the image from there?

    Could I use an object tag to accomplish this?..because an iframe isn't really what I'm looking for

    Note: I can't just use an image tag with "example.com/image1" because the image only loads when accessed and redirected from redirect.com/image1

    Hope that makes sense,

    Thanks! :)


Comments

  • Registered Users Posts: 1,298 ✭✭✭off.the.walls


    sorry do you mean use a image thats stored on the web so its like

    <img src="www.myimages.com/myimage1.jpg"/>
    so that way it just takes the image from where its already hosted online?

    thats what i got from this.


  • Registered Users Posts: 10,641 ✭✭✭✭28064212


    If it's properly redirected, <img src=redirect.com/image1 /> should work on its own. How is the redirect done? Which sites do you have control over (example.com, redirect.com or neither)?

    Boardsie Enhancement Suite - a browser extension to make using Boards on desktop a better experience (includes full-width display, keyboard shortcuts, dark mode, and more). Now available through your browser's extension store.

    Firefox: https://addons.mozilla.org/addon/boardsie-enhancement-suite/

    Chrome/Edge/Opera: https://chromewebstore.google.com/detail/boardsie-enhancement-suit/bbgnmnfagihoohjkofdnofcfmkpdmmce



  • Registered Users Posts: 1,298 ✭✭✭off.the.walls


    Why don't you just use the url of the actual image instead of going via a redirect?


  • Closed Accounts Posts: 2,301 ✭✭✭The One Who Knocks


    Sorry guys, I'll try to be more clear.
    28064212 wrote: »
    If it's properly redirected, <img src=redirect.com/image1 /> should work on its own. How is the redirect done? Which sites do you have control over (example.com, redirect.com or neither)?

    I don't have control of either site, however, I do have permission to use the image on my site.
    Why don't you just use the url of the actual image instead of going via a redirect?

    Okay here's the thing, I can't use example.com/image1 because that url is only accessible via redirect.com/image1. This is because example.com/image1 is time based, and it expires and changes location frequently.

    For example,
    Today the image could be located at
    example.com/image1-ae3rasdf3sp
    Tomorrow the image could be located at
    example.com/image1-e7dj72oso3
    and so on...

    BUT- Redirect.com/image1 keeps track of the images location, and redirects to the images current location.

    I know that I could just save the image and host it myself, but this isn't just a single image that is affected, and so I would have to host possibly hundreds of images.

    Hope that explains things a little better,

    Thanks, :)


  • Registered Users Posts: 10,641 ✭✭✭✭28064212


    Jamez735 wrote: »
    I don't have control of either site, however, I do have permission to use the image on my site.
    So what happens if you just use <img src="redirect.com/image1" />?

    Boardsie Enhancement Suite - a browser extension to make using Boards on desktop a better experience (includes full-width display, keyboard shortcuts, dark mode, and more). Now available through your browser's extension store.

    Firefox: https://addons.mozilla.org/addon/boardsie-enhancement-suite/

    Chrome/Edge/Opera: https://chromewebstore.google.com/detail/boardsie-enhancement-suit/bbgnmnfagihoohjkofdnofcfmkpdmmce



  • Advertisement
  • Closed Accounts Posts: 2,301 ✭✭✭The One Who Knocks


    28064212 wrote: »
    So what happens if you just use <img src="redirect.com/image1" />?

    If I use <img src="redirect.com/image1" /> it just returns a broken image, the browser doesn't even follow the redirect at all, :/

    Oh wait, I might have a solution, lemme check!


  • Closed Accounts Posts: 2,301 ✭✭✭The One Who Knocks


    Ughh I just tried to post a big long message explaining how I fixed it, but I was logged out and lost it :(
    (In short, I used a slightly different url to redirect.com/image1)

    Anyway it's fixed! thank god! :D

    Now one last question, it doesn't matter, but this was my previous attempt at a fix.

    <object width="300" height="300" object data="http://www.redirect.com/image1&quot; type="image/jpg"></object>

    This worked perfectly for some images, as it followed the redirect. However, for other images, it actually redirected the user to the page where the image was hosted! (when they loaded my site)

    Any ideas what was wrong?


Advertisement