Ortuna / padrino-pipeline

Sprockets for padrino apps
MIT License
21 stars 8 forks source link

image-asset-subfolders #28

Open chaosprinz opened 10 years ago

chaosprinz commented 10 years ago

Hi, i am using Master-brunch of this gem, along with padrino 0.12.0, sprocket 2.12.1 and uglifier 2.5.0. I set it up in my app with this:

    register Padrino::Pipeline

    configure_assets do |config|
      #binding.pry
      config.pipeline = Padrino::Pipeline::Sprockets
    end

I use an image_tag that way:

image_tag("player/previous.svg")

which compiles to:

<img src="/assets/images/actions/document-add.svg">

This is, what i expected. But the path, that was generated throw me an "Not found"(404)-Error.

I used the debugger in the config and checked if the image_assests-Folder exists. Also i checked up the image.

File.exists? config.image_assests    # <= returns true
File.exists? File.join( config.image_assets, "actions", "document-add.svg" )  # <= returns true

So the files exist and are readable. I chmoded them to 777, just to get sure.

Now i tried to move the images out the subdirectories, so they all are lying under assets/images and loaded these with a image-tag like this:

image_tag("previous.svg")

and voila: it loads.

I use many images with the same name, but in different sices, and much of them are automatically generated, based on user-input. And there will be thousands of them. Subfolders for the related Users and Contents are absolutely neccessary.

Is there already any way to handle this with this gem ? In my oppinion it would be a killer-feature.

Ortuna commented 10 years ago

I'm not sure what the behavior should be for this. But I can look into this, if you wanted to you could also send a PR and we can work it out together :smile_cat:

chaosprinz commented 10 years ago

I have subfolders in my images-folder. There is one Folder per User and in this folders there are subfolders for the posts the create. In these subfolders there are more subfolders for images the user loads up and works on. This is done with carrierwave and mini_magick. So i have images like in a folder-structer like this: assets/images/username/post/actions/play_button So i want to call it like this:

image_tag("images/username/post/actions/play_button")

I think i will find time next week, to have a look into it.