Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

Display remote image as though it is a local image

  • 09-11-2007 06:02PM
    #1
    Registered Users, Registered Users 2 Posts: 378 ✭✭


    Ok not sure if that subject is clear...

    But I need to have a method of displaying images on my site as though they came from my site. I am using jsp's and have come up with this so far...

    getaremoteurl.jsp
    <&#37;@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
    <%@ page contentType="image/jpeg" %>
    <c:import url="<%=request.getParameter("loc")%>" />
    

    a test for this I imagine is...
    <img src="/getaremoteurl.jsp?loc=http://www.nodomain.com/image.jpg">
    

    It just displays the ansi interpretation of the image file... any ideas? Or another method for doing this?


Comments

  • Registered Users, Registered Users 2 Posts: 12,025 ✭✭✭✭Giblet


    Write a servlet to handle a request and response. The response type would be the image/jpeg.

    Also, <c:import url="${param.loc}"> would work.


  • Registered Users, Registered Users 2 Posts: 378 ✭✭sicruise


    Cheers...

    I was just kind of hoping there was an easier way... so basically I should get the bytes from the file and write to the output stream?


Advertisement