# How to get the url of a loaded image

**URL:** <https://www.ruby-forum.com/t/how-to-get-the-url-of-a-loaded-image/85604>\
**Category:** Rails\
**Created:** [February 14, 2007, 10:02pm UTC](https://www.ruby-forum.com/t/how-to-get-the-url-of-a-loaded-image/85604 "2007-02-14T22:02:31Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![henry32](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/f9ae1b/32.png) [@henry32](https://www.ruby-forum.com/u/henry32)\
**Post date:** [February 14, 2007, 10:02pm UTC](https://www.ruby-forum.com/t/how-to-get-the-url-of-a-loaded-image/85604/1 "2007-02-14T22:02:31Z")

</div>

I am making a call to an api method that returns an image based on the  
parameters I pass. What is the best way to capture the url of the  
returned image? Thanks.

---

<div class="post-metadata">

**Author:** ![henry32](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/f9ae1b/32.png) [@henry32](https://www.ruby-forum.com/u/henry32)\
**Post date:** [February 15, 2007, 1:43am UTC](https://www.ruby-forum.com/t/how-to-get-the-url-of-a-loaded-image/85604/2 "2007-02-15T01:43:15Z")

</div>

Henry Jones wrote:

> I am making a call to an api method that returns an image based on the  
> parameters I pass. What is the best way to capture the url of the  
> returned image? Thanks.

You have to give more info for us to help you.

I am personally confused because you are calling this api, at a specific  
url, right? If it returns an image, isn’t the url that you sent the  
request to the url of the image? If so, you should know the url of the  
image before you send the request.

Are you getting the binary data as part of an xml response?

---

<div class="post-metadata">

**Author:** ![henry32](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/f9ae1b/32.png) [@henry32](https://www.ruby-forum.com/u/henry32)\
**Post date:** [February 15, 2007, 3:27am UTC](https://www.ruby-forum.com/t/how-to-get-the-url-of-a-loaded-image/85604/3 "2007-02-15T03:27:45Z")

</div>

Alex W. wrote:

> Henry Jones wrote:
> 
> > I am making a call to an api method that returns an image based on the  
> > parameters I pass. What is the best way to capture the url of the  
> > returned image? Thanks.
> 
> You have to give more info for us to help you.
> 
> I am personally confused because you are calling this api, at a specific  
> url, right? If it returns an image, isn’t the url that you sent the  
> request to the url of the image? If so, you should know the url of the  
> image before you send the request.
> 
> Are you getting the binary data as part of an xml response?

Sorry to be a little vague. The photo service that I am working with  
does have an api, but currently it only provides the url to the full  
size image. For what I am doing, this is not optimal since I am loading  
many images at once and displaying them at smaller sizes. So as a  
temporary fix, they provided me with a url to call and pass in the  
desired size. That url then apparently creates and stores the new sized  
image, and redirects to that image, which has its own url. I was asked  
to make the call to the first url and then for subsequent calls use the  
url of the generated image.

So, my question is… how do I grab the url of the image I get back? I  
know it is strange, but they say that is all they can do right now.
