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

CLI batch resize #70

Open
dgsiegel opened this issue Nov 24, 2022 · 5 comments
Open

CLI batch resize #70

dgsiegel opened this issue Nov 24, 2022 · 5 comments

Comments

@dgsiegel
Copy link

What are you trying to do?

I am currently trying to import a few hundred images via the CLI. It would be great to run batch resize via CLI, instead of having to log into the control panel.

What's your proposed solution?

Add a CLI command :)

Additional context

No response

@romainpoirier
Copy link

I'm following up on this feature request.

Currently, the bulk resize functionality in the control panel (under /image-resizer/settings) lists all subfolders rather than volumes. In my setup, this results in hundreds of folders, causing the manual operation to be very extremely slowly to run.

It would be extremely useful if the bulk resize could be performed at the volume level, and even better using a CLI command. Do you have any updates or plans for addressing this issue in Craft CMS 5?

@engram-design
Copy link
Member

Added the console command for the next release. To get this early, run

  • composer require verbb/image-resizer:"dev-craft-4 as 3.0.12".
  • composer require verbb/image-resizer:"dev-craft-5 as 4.0.2".

Supply either a folder-id or volume which supports multiple items with a comma:

./craft image-resizer/resize/bulk --volume=general,gallery
./craft image-resizer/resize/bulk --folder-id=1628,567

@romainpoirier
Copy link

Thank you for the addition! However, are you sure the console command was actually pushed?

After updating to dev-craft-5 as 4.0.2, I encountered the following error when trying to run:

./craft image-resizer/resize/bulk --volume=images

Unknown command: image-resizer/resize/bulk
Caused by: Exception 'yii\base\InvalidRouteException' with message 'Unable to resolve the request "image-resizer/resize/bulk".'

in /var/www/html/vendor/yiisoft/yii2/base/Module.php:561

Stack trace:
#0 /var/www/html/vendor/yiisoft/yii2/console/Application.php(180): yii\base\Module->runAction('image-resizer/r...', Array)
#1 /var/www/html/vendor/craftcms/cms/src/console/Application.php(91): yii\console\Application->runAction('image-resizer/r...', Array)
#2 /var/www/html/vendor/yiisoft/yii2/console/Application.php(147): craft\console\Application->runAction('image-resizer/r...', Array)
#3 /var/www/html/vendor/craftcms/cms/src/console/Application.php(122): yii\console\Application->handleRequest(Object(craft\console\Request))
#4 /var/www/html/vendor/yiisoft/yii2/base/Application.php(384): craft\console\Application->handleRequest(Object(craft\console\Request))
#5 /var/www/html/craft(13): yii\base\Application->run()
#6 {main}
Failed to execute command ./craft image-resizer/resize/bulk --volume=images: exit status 1

Additionally, I couldn't find this command in the plugin's source code. Could you confirm whether it is included?

@engram-design
Copy link
Member

Whoops, you're right, simply forgot to push that merge. Let me know how that goes?

@romainpoirier
Copy link

Thanks, I can confirm that it works now!

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

No branches or pull requests

3 participants