Budrys Posted March 19, 2020 Share Posted March 19, 2020 Hello. Is there any way to list links to all images in PS? Link to comment Share on other sites More sharing options...
Guest Posted March 21, 2020 Share Posted March 21, 2020 What kind of question is that ? Do you want to show all links somewhere or do you want to save all links to a file? Specify your question, idea. Link to comment Share on other sites More sharing options...
Budrys Posted March 21, 2020 Author Share Posted March 21, 2020 I would like to Save links to all images. I need to find them and Use some image optimalization module. Link to comment Share on other sites More sharing options...
Guest Posted March 21, 2020 Share Posted March 21, 2020 (edited) OK. Here is an example of displaying all full links to the images. <?php ini_set('display_errors', 1); ini_set('display_startup_errors', 1); error_reporting(E_ALL); include(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'config.inc.php'); include(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'settings.inc.php'); include(dirname(__FILE__) . '/init.php'); $get_images = Db::getInstance()->ExecuteS('select * from '._DB_PREFIX_.'image order by id_product asc;'); $get_images_type = Db::getInstance()->ExecuteS('select * from '._DB_PREFIX_.'image_type order by id_image_type asc;'); foreach ($get_images as $get_image) { $image = new Image($get_image['id_image']); $image_url = Tools::getHttpHost(true).__PS_BASE_URI__.'img/p/'.$image->getExistingImgPath().".jpg"; echo $image_url.'<br />'; foreach ($get_images_type as $get_image_type) { $image_url = Tools::getHttpHost(true).__PS_BASE_URI__.'img/p/'.$image->getExistingImgPath().'-'.$get_image_type['name'].".jpg"; echo $image_url.'<br />'; } } Here is an example of saving all full links to images. <?php ini_set('display_errors', 1); ini_set('display_startup_errors', 1); error_reporting(E_ALL); include(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'config.inc.php'); include(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'settings.inc.php'); include(dirname(__FILE__) . '/init.php'); $images_path = ''; $get_images = Db::getInstance()->ExecuteS('select * from '._DB_PREFIX_.'image order by id_product asc;'); $get_images_type = Db::getInstance()->ExecuteS('select * from '._DB_PREFIX_.'image_type order by id_image_type asc;'); foreach ($get_images as $get_image) { $image = new Image($get_image['id_image']); $image_url = Tools::getHttpHost(true).__PS_BASE_URI__.'img/p/'.$image->getExistingImgPath().".jpg"; $images_path .= $image_url."\r\n"; foreach ($get_images_type as $get_image_type) { $image_url = Tools::getHttpHost(true).__PS_BASE_URI__.'img/p/'.$image->getExistingImgPath().'-'.$get_image_type['name'].".jpg"; $images_path .= $image_url."\r\n"; } } file_put_contents('image-list.txt',$images_path); echo 'Done'; If I helped you, rate me 😉 Edited March 28, 2020 by Guest (see edit history) Link to comment Share on other sites More sharing options...
Budrys Posted March 21, 2020 Author Share Posted March 21, 2020 Thank You 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