Shopware resources and help articles

Simple and to the point. Optimized by the community.

Get Image Path & File Name for All Images

0
by Kavindu Thundeniya, last modified on September 11th, 2021

Media

SELECT Concat(file_name, '.', file_extension) AS "file_name",
       Concat ('https://<domain>/media/',
       Substring(Md5(Lower(Hex(id))), 1, 2),
       '/', Substring(Md5(Lower(Hex(id))), 3, 2), '/',
       Substring(Md5(Lower(Hex(id))), 5, 2), '/',
       LEFT(Unix_timestamp(uploaded_at), Char_length(Unix_timestamp(uploaded_at)
                                         ) - 4),
       '/', file_name, '.', file_extension)  AS "file_path"
FROM   `media` 

Thumbnails

SELECT Concat(file_name, '.', file_extension) AS "file_name",
       Concat ('https://<domain>/thumbnail/',
       Substring(Md5(Lower(Hex(id))), 1, 2),
       '/', Substring(Md5(Lower(Hex(id))), 3, 2), '/',
       Substring(Md5(Lower(Hex(id))), 5, 2), '/',
       LEFT(Unix_timestamp(uploaded_at), Char_length(Unix_timestamp(uploaded_at)
                                         ) - 4),
       '/', file_name, '.', file_extension)  AS "file_path"
FROM   `media` 

Discussion

0 comments

We use cookies to measure the performance of this website. Do you want to accept these cookies?