Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > Prawn relative-path image

Reply
Thread Tools

Prawn relative-path image

 
 
Michael Wong
Guest
Posts: n/a
 
      05-02-2009
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?
--
Posted via http://www.ruby-forum.com/.

 
Reply With Quote
 
 
 
 
Gregory Brown
Guest
Posts: n/a
 
      05-03-2009
On Sat, May 2, 2009 at 7:45 PM, Michael Wong <(E-Mail Removed)> 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

--
BOOK: http://rubybestpractices.com
TECH: http://blog.majesticseacreature.com
NON-TECH: http://metametta.blogspot.com

 
Reply With Quote
 
 
 
 
Michael Wong
Guest
Posts: n/a
 
      05-03-2009
Thank you. In the future, definitely will post on prawn-ruby.
--
Posted via http://www.ruby-forum.com/.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Prawn - Taking a page from one pdf to place in a prawn one. Adam Akhtar Ruby 1 07-06-2010 12:45 PM
[ANN] Prawn 0.2 - Fast, Nimble Ruby PDF Generation Gregory Brown Ruby 1 09-13-2008 07:09 PM
[ANN] prawn-gallery now on Github Gregory Brown Ruby 0 08-04-2008 10:53 PM
Graphic Designers : Prawn needs a logo! Gregory Brown Ruby 2 07-26-2008 07:24 PM



Advertisments