image on dynamic pages

Hello all,

I am building a wix site with dynamic pages. I have a database containing text fields as well as a field which contains the filenames of images I want to show in each dynamic page. For example dyanmic page 1 shows image 1, page 2 shows image 2 and so on.
Using $w(“#img”).src, I can set the image source to images at various URLs but I cant set the source to use images I have already uploaded. I guess the main problem is I dont know the image names for images in Media Manager. For example, I uploaded an image M01.jpg but when I try $w(“#image”).src=“wix:image://M01.jpg”, the image will not be displayed.
Does anyone know how I can use wix:image to access the images already in Media Manager?

Thanks all for your help!
Ken

Hi Ken,

Were the images uploaded by you or by your users, via the upload button element?
To get the url of images uploaded manually by the media manager right click the download button > copy link address.
You will get a link similar to this:

Next, remove the part after and including the question mark to get the absolute url:

If you are referring to images uploaded by users via the upload button element, you can get the url either from the upload element, or by querying the relevant collection.
You can find out more about the upload button here

Hello,

Thanks very much for your reply. I can now set src correctly using “http://…” for images on another server.

However I can not get “image://…” to work with images I uploaded to wix.

For example, I have an image at -

https://static.wixstatic.com/media/2add2c_2f754ca0cbb04d40a1eb8458c401c092~mv2. jpg ?dn=M08.jpg

I tried -

image://media/2add2c_2f754ca0cbb04d40a1eb8458c401c092~mv2.jpg?dn=M08.jpg
image://2add2c_2f754ca0cbb04d40a1eb8458c401c092~mv2.jpg?dn=M08.jpg
image://2add2c_2f754ca0cbb04d40a1eb8458c401c092~mv2.jpg

but none works. What should be the correct parameters for “image://…” for images uploaded to wix?

In addition, if I upload the image M08.jpg, the download link from Media Manager is -

https://static.wixstatic.com/media/2add2c_2f754ca0cbb04d40a1eb8458c401c092~mv2. jpg ?dn=M08.jpg

Is there are way to rename this internal file back to M08.jpg as the filename is coming from the CSV for the collection? Or is it possible to find out that e.g. M08.jpg has been renamed to 2add2c_2f754ca0cbb04d40a1eb8458c401c092~mv2. jpg?

Thanks again for your help!

Regards,
Ken

Hi Ken,

To convert the absolute url to Media Manager url replace https://static.wixstatic.com/media with image://v1:

https://static.wixstatic.com/media /2add2c_2f754ca0cbb04d40a1eb8458c401c092~mv2.jpg

image://v1 /2add2c_2f754ca0cbb04d40a1eb8458c401c092~mv2.jpg