Jump to content

product image url


speriamobene

Recommended Posts

  • 2 weeks later...

Hi, it seems to be image_id by digits, I guess.

 

Anyway after googling I found that getting image URL is easy by this code:

// get Product cover image (all images is possible retrieve by
// Image::getImages($id_lang, $id_product) or
// $productInstance->getImages($id_lang))
$id_image = Product::getCover($id_product);
// get Image by id
if (sizeof($id_image) > 0) {
$image = new Image($id_image['id_image']);
// get image full URL
$image_url = _PS_BASE_URL_._THEME_PROD_DIR_.$image->getExistingImgPath().".jpg";
}

 

This works for PrestaShop 1.4.6

Link to comment
Share on other sites

  • 9 months later...
  • 8 months later...

hi! tnx for this post...

is there a way to get the small image of product generated by presta?

 

Using the code provided by boris.suska you could replace this 

$image_url = _PS_BASE_URL_._THEME_PROD_DIR_.$image->getExistingImgPath().".jpg";

with this

$image_url = _PS_BASE_URL_._THEME_PROD_DIR_.$image->getExistingImgPath()."-small_default.jpg";
Edited by stefanbc (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...