Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: multiple image resizing options #11

Open
hamishtaplin opened this issue Feb 6, 2014 · 6 comments
Open

Feature request: multiple image resizing options #11

hamishtaplin opened this issue Feb 6, 2014 · 6 comments

Comments

@hamishtaplin
Copy link

It would be fantastic if you could generate lots of different size images, with a configurable naming convention for the output.

@boennemann
Copy link
Contributor

Thanks for your Feature Request,

could you please submit some sample/dream configuration so I can better understand what you're asking for.

@davidgorges
Copy link

+1

Config could look like:

 image_resize: {
            options: {
                width: 100,
                height: 100,
                overwrite: false
            },
           dist: {
               src: ['src/img/*.jpg'],
               dest: 'dist/img/'
            },
        },

right not, this produces a fatal error:

Fatal error: Can not optimize more than one image per destination.
You need to use a different 'files' format in your Gruntfile.

@felixortegam
Copy link

Hi, I was having the same problem. The solution is expand:true in files settings.

My example:

module.exports = function (grunt) { grunt.initConfig({ image_resize: { options: { width: 1000, quality: 0.9, overwrite: true, }, files: { expand: true, src: ['*.jpg'], dest: 'upload/', ext: '.jpg' } } });

grunt.loadNpmTasks('grunt-image-resize');
grunt.registerTask('default', ['image_resize'])

}

@samdbeckham
Copy link

This still doesn't seem to work. I'm getting the following error:

Warning: Object true has no method 'indexOf' Use --force to continue.

It seems to be expand: true that's causing this.

@samdbeckham
Copy link

Nevermind, I've sorted it. I used the same syntax as the imagemin task in the Gruntfile.

Might be worth popping this in the docs.

image_resize: {
  options: {
    width: 100
  },
  resize: {
    files: [{
        expand: true,
        cwd: 'test/fixtures',
        src: '{,*/}*.{gif,jpeg,jpg,png}',
        dest: 'tmp'
    }]
  }
}

@MiLk
Copy link
Contributor

MiLk commented Sep 5, 2014

I'm using #16 for several months.
The syntax is a bit cleaner.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants