Forum: Ruby Prawn relative-path image

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Michael W. (Guest)
on 2009-05-03 03:45
Hi, I would like to show an image on PDF (via prawn pdf.image). I am
using a photo_for helper to retrieve an image i.e. photo_for(@account,
:small), which yields <img alt="logo_small" border="0"
src="/photos/0000/00123/logo_small.JPG?21343435445" />

Is there a way to use image relative path with pdf.image? how would you
approach this problem?
Gregory B. (Guest)
on 2009-05-03 04:26
(Received via mailing list)
On Sat, May 2, 2009 at 7:45 PM, Michael W. 
<removed_email_address@domain.invalid> wrote:
> Hi, I would like to show an image on PDF (via prawn pdf.image). I am
> using a photo_for helper to retrieve an image i.e. photo_for(@account,
> :small), which yields <img alt="logo_small" border="0"
> src="/photos/0000/00123/logo_small.JPG?21343435445" />
>
> Is there a way to use image relative path with pdf.image? how would you
> approach this problem?

This is the wrong place to post Prawn questions.  In the future, use:

http://groups.google.com/group/prawn-ruby

Actually, Prawn has no support at all for remote images, the trick you
may have seen in examples just uses open-uri:

require "open-uri"
pdf.image open("http://foo.com/bar.png")

You can use this trick, but you'll need to construct the full URL
yourself.   Prawn doesn't know or care about the fact that you're
using Rails (or the web) and never will.  But relative image urls for
Rails might be useful for Prawnto, so talk to thorny_sun about that.

-greg
Michael W. (Guest)
on 2009-05-03 04:35
Thank you.  In the future, definitely will post on prawn-ruby.
This topic is locked and can not be replied to.