In Which table Product image url stored in Prestashop
Product image urls are not stored in database. The location is based on the id_image
field of ps_image
table.
An image having 1234
for id will be stored under /img/p/1/2/3/1234.jpg
.
An image having 1514
for id will be stored under /img/p/1/5/1/1514.jpg
.
I invite you to check /classes/Image.php
and /classes/ImageManager.php
for more informations.
As told by Floarian images are stored in {DB_PREFIX}image
table and located in img/p
folder based on id of the image.
If you have moved images as per new system, your images are located as told by Floarian but url of image will be like..
{YOUR_SITE_URL}/img/p/{ID_IMAGE}-{IMAGE_TYPE}/{FRIENDLY_URL_OF_PRODUCT}.jpg
e.g.
www.testsite.com/img/p/1234-home_default/my-test-product.jpg
As stated in earlier answers, the URL of the images is built using the id_image
field (stored in ps_image
table) related to a given product.
Here is a (simplified) SQL query to retrieve id_image
value for each product:
SELECT ps_product.id_product, ps_image.id_image FROM ps_product, ps_imageWHERE ps_image.id_product = ps_product.id_product AND ps_image.position = 1
And here is how to build related URLs :
// [...] run SQL query and fetch an array of resulting rowsforeach($rows as $row) { $url = '/img/p/'.implode('/', str_split((string) $row[1])).'/'.$row[1].'.jpg';}
Hope this helps ...