Jump to content

Images links


Budrys

Recommended Posts

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

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 😉

obrazek.png.98b3fffe10ee186d4390d0b83f8038a4.png

 

Edited by Guest (see edit history)
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...