nabo Posted May 26, 2017 Share Posted May 26, 2017 Hello is there a way to generate a different size image via api during the same process of import? product->setOutputFormatting(false); $product->images->add($file_url); $product->save(); Link to comment Share on other sites More sharing options...
Ivan Gretsky Posted May 26, 2017 Share Posted May 26, 2017 The way I would deal with the question is looking at InputfieldImage's code. It has an option to resize image if it is larger than defined maximum width and hight. I think it is around here. The logic seems to be: loading the original sized image first, making a resized copy, then deleting original image and saving resized image with original image filename. Link to comment Share on other sites More sharing options...
Robin S Posted May 27, 2017 Share Posted May 27, 2017 @nabo, I think you can just do some Pageimage resizing method on the last item in the field, which will be the image you just added. $product->setOutputFormatting(false); $product->images->add($file_url); $product->save(); // create variation of image $product->images->last->size(400, 300); // whatever resizing method you want 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now