costin_yo Posted April 16, 2020 Share Posted April 16, 2020 (edited) Hello, I have an API module that takes the images from the product and sends them to another website. The problem is that the other website recently changed their images from square to landscape and all my products has square images and I do not want to change. I checked the API module and I want to create another image set in prestashop (like cart_default, home_default etc.) to be the size that the other website needs. This module has the following code to get the images from products: $product_images = array(); $link = new Link(); $imagelinks = array(); $images = $product_data->getImages($id_lang); foreach ($images as $image) { $p_images = array(); $p_images['url'] = Tools::getShopProtocol() . $link->getImageLink( $product_data->link_rewrite, $id_product . '-' . $image['id_image'] ); $product_images[] = $p_images; } $product_return["images"] = $product_images; Please let me know what do I need to change to this code to get a specified image category set already created. For example I want to get all images from products with "cart_default" size. Thank you very much and I hope someone will answer before the other website changes his layout again. Edited April 16, 2020 by costin_yo (see edit history) Link to comment Share on other sites More sharing options...
Knowband Plugins Posted April 16, 2020 Share Posted April 16, 2020 To get default home image size, use $link->getImageLink($product_data->link_rewrite,$id_product . '-' . $image['id_image'], ImageType::getFormattedName('home')); instead of $link->getImageLink($product_data->link_rewrite,$id_product . '-' . $image['id_image']); 1 Link to comment Share on other sites More sharing options...
costin_yo Posted April 16, 2020 Author Share Posted April 16, 2020 It worked flawlessly !!! 😁🤩 Thank you very very much...! Link to comment Share on other sites More sharing options...
pasha4ur Posted August 20, 2022 Share Posted August 20, 2022 Hello. Be careful with this person @costin_yo. He offers Ukrainians help with getting donations, and then steals the money, explaining that he needs to repay his loans. 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