0

I've deployed my basic rails app to Heroku and everything is fine (mainly!) except for some large images in a carousel on the landing page. All of the other images are fine, so it seems that the images are disallowed due to their size. But all I know is that the whole app is limited to 500MB on Heroku, and my app is well under this. I have also tried removing the carousel but this made no difference. The images are working in the local host, but not on Heroku. I would give some of my code below, but I'm not sure what is relevant. Anyway, I would really appreciate some suggestions, thanks :-)

EDIT

I'm using HTML image links in the carousel like this:

<img class="d-block w-100" src="/assets/GettyImages.jpg" alt="First slide">

But I did try with rails links too, like this:

<%= image_tag ("/assets/GettyImages.jpg"), size: "100%" %>
Robert
  • 109
  • 3
  • 13
  • How are you linking to the images? – DickieBoy May 09 '18 at 12:19
  • Can you provide your app link? – Akash Pinnaka May 09 '18 at 12:19
  • I've just added image links in the edit – Robert May 09 '18 at 12:39
  • 1
    It's no problem with your links. Heroku won't store your images: you should consider using cloud services like AWS. – kart-able May 09 '18 at 13:41
  • @kart-able thanks, I thought this might be the case, but I couldn't find it stated anywhere – Robert May 09 '18 at 13:49
  • @kart-able Assuming the images are stored in the git repo, why wouldn't they be available on the Heroku instance? – Charlie Schliesser May 09 '18 at 13:51
  • can you link to the app so we can inspect it, also if the images are in the git repo than you should not have an issue showing them on the app but if you are uploading them to the app on heroku keep in mind heroku does not store files so while they may appear at first they will eventually vanish. – Rockwell Rice May 09 '18 at 15:25
  • Try to access the image directly in the browser navbar. So we know you can access it. You can also try adding gem `rails_12factor` gem if you are not running rails 5 – Maxence May 10 '18 at 00:14
  • @RockwellRice the images are fixed and not uploaded to the app, but I didn't know that Heroku doesn't store files like that. I think I will have to sort out my AWS account, but I don't know of any image size restriction, so I don't see why these large images don't work. The app is here: https://globalenglish.herokuapp.com/about – Robert May 10 '18 at 02:11
  • Can access any image with name GettyImages.jpg from your app. Is the name correct ? – Maxence May 12 '18 at 00:41
  • @Maxence I'm not able to access this image, this is my problem. The name is correct, yes. – Robert May 12 '18 at 04:51
  • Make sure you get all files on Heroku as intended by checking assets folder https://stackoverflow.com/questions/38924458/how-to-see-files-and-file-structure-on-a-deployed-heroku-app and also make sure you precompile every image with the following code in the assets.rb file : `Rails.application.config.assets.precompile += %w[*.png *.jpg *.jpeg *.gif *.svg]` – Maxence May 12 '18 at 11:01

0 Answers0