zweitag / middleman-images

Resize and optimize images for Middleman
MIT License
17 stars 3 forks source link

Images are not resized #36

Closed asecondwill closed 5 years ago

asecondwill commented 5 years ago

Installing like this:

Gemfile
gem 'middleman-images', git: 'https://github.com/zweitag/middleman-images'
gem 'image_optim_pack'

config.rb
configure :build do
  activate :images

...

And then trying to resize image in template:

<%= image_tag "/blog/#{article.date.strftime('%Y')}/#{article.slug}/#{article.data.cover_image}",
     resize: '800x200',
     class: 'blog_thumb' %>

Restarting middleman server and checking page, the image tag looks like this:

<img src="/blog/2019/testing-with-rails-activestorage/testing.jpg" resize="800x200" class="blog_thumb" alt="Testing" width="1000" height="400">

pmk1c commented 5 years ago

The images will currently only get resized when building the page, not in Middleman's server mode. Did you try middleman build and looked at the output?

asecondwill commented 5 years ago

Thanks for your speedy response : )

I didn't realise that, so i tried agani and checked it, but still not working.

I don't think that is going to be a very good workflow having the resized images only in build. Makes it hard to develop the site and style the new images, know they are working etc.

pmk1c commented 5 years ago

@asecondwill Yes it is. Unfortunately processing ressources on demand in Middleman server mode, is very time consuming. You can enable it by removing the configure :build block around the configuration, but you will probably not have a good experience.

We're currently looking for a solution to that problem.

asecondwill commented 5 years ago

no probs. appreciate the trickyness of that. Ill close this as question answered.