Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8579923
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T20:42:57+00:00 2026-06-11T20:42:57+00:00

I’m using paperclip to allow users to upload a logo, which is stored in

  • 0

I’m using paperclip to allow users to upload a logo, which is stored in the database

company_setting.rb model:

has_attached_file :logo_image,
      :storage => :database,
      :styles => {:original => "160x80>",
                  :small  => {:geometry =>"100x50>" , :column =>'logo_image_small_file'}},
      :url => '/settings/:id/logo_images?id=:id&style=:style'

I have no problem rendering this image to html as follows in a html.erb view

<%=  image_tag current_user.company.company_setting.logo_image.url + "&id=#{current_user.company.company_setting.id}" %>

However, I cannot get the same image to render in my pdf.erb file. I’ve previously experienced issues with pdfkit and the asset pipeline. I think pdfkit requires the full url to find an image so I’ve tried numerous ways such as:

<%=  image_tag "#{Rails.root}" + current_user.company.company_setting.logo_image.url + "&id=#{current_user.company.company_setting.id}" %>

Still not rendering. Anyone got any ideas?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T20:42:58+00:00Added an answer on June 11, 2026 at 8:42 pm

    So it turns out that there were 2 problems with what I am trying to do here.

    Firstly, the full url that I created was wrong. I changed the construction of the url for the image tag to:

    <%=  image_tag URI.join(root_url(:subdomain => current_user.company.subdomain),(company_setting.logo_image.url + "&id=#{company_setting.id}"))).to_s%>
    

    This allows for the subdomain to be added in front of the base url, whether in development or production. (Railscast here)

    The second problem is that when the pdf is requested, a deadlock occurs, i.e. there is a call to the server for the logo image and for the pdf and neither can complete until the other is finished. I haven’t come up with a solution to this that I’m satisfied with. It is solved by setting config.threadsafe! in the production.rb and development.rb files which effectively loads all resources and code before carrying out any server requests. This is fine in production, however setting this in the development.rb means that I can’t carry out F5 driven development….the server needs to be restarted for each change to be seen in the browser. I’m looking into caching the image and serving it locally or figuring out threaded requests locally (using WeBrick server)

    In the meantime, since I’ve set the pdf up and I don’t really need to edit it (yet!) I have set up threadsafe in production and not in development with a conditional on the image:

    <% if !Rails.env.development? %>
        <%=  image_tag URI.join(root_url(:subdomain......%>
    <% end %> 
    

    Not ideal but it will do for now….

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using Paperclip to handle profile photo uploads in my app. They upload
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
That's pretty much it. I'm using Nokogiri to scrape a web page what has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I am trying to understand how to use SyndicationItem to display feed which is
I used javascript for loading a picture on my website depending on which small
I am reading a book about Javascript and jQuery and using one of the
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I would like to run a str_replace or preg_replace which looks for certain words

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.