Archalia Posted September 13, 2020 Share Posted September 13, 2020 Hello guys, I want to display the thumbnail of a given Product within an Admin page built with symfony. I am doing it this way: $product = new Product($id, false, $lang); $imageProduct = new Image($product->getCover($id)['id_image']); $img = ImageManager::thumbnail( _PS_IMG_DIR_ . 'p/' . $imageProduct->getExistingImgPath() . '.jpg', 'product_small_' . $id . '.jpg', 45, 'jpg' ); the result is: <img src="../img/tmp/product_small_1.jpg?time=1599958131" alt="" class="imgm img-thumbnail"> but the path is invalid, this one works : /img/tmp/product_small_1.jpg?time=1599958131 Do you know why I don't get the correct path in the first place ? Am I doing it wrong ? Link to comment Share on other sites More sharing options...
Archalia Posted September 13, 2020 Author Share Posted September 13, 2020 (edited) ok it seems the proper way to do this is: $product = new Product($id, false, $lang); $img = $product->getCover($id); $url = Context::getContext()->link->getImageLink(isset($product->link_rewrite) ? $product->link_rewrite : $product->name, (int) $img['id_image'], 'small_default'); Edited September 13, 2020 by Archalia (see edit history) 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