janczizikow / sleek

:chart_with_upwards_trend: Sleek is a modern Jekyll theme focused on speed performance & SEO best practices
https://janczizikow.github.io/sleek/
MIT License
423 stars 638 forks source link

image thumbnails #22

Closed diomed closed 6 years ago

diomed commented 6 years ago

hello

I'm using your theme and got a question about could you improve something; I have image for my blog post and it's displayed ok when I open it. However, when post is listed in cards it requires thumbnail /img/posts/edison-light-bulbs_925x_thumb.jpg which I should make myself?

Isn't there some kind of way for jekyll to autogenerate thumbnails, and could you maybe implement it into theme, so me and other users of this theme don't have to resize images to thumbnails?

Thanks for theme, it's pretty swell! 👍

janczizikow commented 6 years ago

Hey @diomed, you can put all the images in the _img/posts/ folder and run gulp img from the command line. If you used ruby gem to install the theme, then you will have to make a gulpfile.js (and install all the packages from npm). You can take a look at the task for images from gulpfile from this repo. Not sure if jekyll has a way to do it, so I used gulp. Let me know if that helps!

bermetj commented 6 years ago

@diomed, make sure your task for images is pointing to the right directory. Once I updated it to point to the right folder it worked.

gulp.task('img', function() {
  return gulp.src('assets/img/posts/*.{png,jpg}')
    .pipe($.responsive({
      // For all the images in the folder
      '*': [{
        width: 230,
        rename: {suffix: '_placehold'},