Solidus (Ruby on Rails) - how to change the logo?

1.8k views Asked by At

I have the demo app up and running but I changed the config/initializers/spree.rb to show:

#Frontend:

#Custom logo for the frontend
config.logo = "logo/1.png"

to change the place it looks for the logo at ,BUT (huge butt) im getting an image error. it displays the name of the picture but not the image.

I Have Already Tired installing ImageMagick

sudo apt-get update  
sudo apt-get install imagemagick --fix-missing

Yet, still no image

3

There are 3 answers

0
Neeraj Rana On

put you image inside app/assest/images and write below code in your view file.

 <%= image_tag '1.png' %>
0
funwhilelost On

Usually that happens in Rails when the image can't be found. The image tag will be created with the alt attribute set and that will be displayed when the image can't be loaded.

Keep in mind that the config value is referencing images in app/assets/images. So in your case the image should be in app/assets/images/logo/1.png.

Hope that helps!

1
notapatch On

Change the logo image in Solidus

Within your Solidus application

  1. Copy the new logo into the logo directory app/assets/images/logo/1.png
  2. Change the image name that the solidus application expects in the configuration file config/initializers/spree.rb you can the find the Solidus template code here.

    Spree.config do |config|
      # Frontend:
    
      # Custom logo for the frontend
      # config.logo = "logo/solidus_logo.png"
      config.logo = "logo/1.png"
    end
    
  3. Restart the Rails server to reload the initialization code and refresh the browser page.

Further Reading