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

Display remote image as though it is a local image

Options
  • 09-11-2007 6:02pm
    #1
    Registered Users 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 Posts: 11,980 ✭✭✭✭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 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