I’m programatically setting the .src property for an image to an external image (hosted on Uploadcare). This has been working for some time, but now suddenly it’s not.
When I inspect the HTML it seems the srcset property does not update to the new image. See that attached screenshot. The src is using the correct URL, but not setsrc.
As far as I can tall I cannot set the srcset property manually. Any ideas?
1 Like
Same issue for me in my website.
Images srcsets don’t work using
$w('#img').src
I noted that it works inside a Repeater element using
$item('#img').src
Preview mode works fine but not in the publish mode…
I’m having the same problem inside a repeater. Weird that it works for you.
Hi,
I have the very same issue and it used to work just fine one week ago.
And just like @farid-berrais it works somehow inside repeaters but not out.
It is very blocking does anyone have a solution please?
It’s very strange it doesn’t work for you inside a Repeater element…
My side, I work with Repeater this way :
I create a Repeater once with all the events needed inside with $w(‘rpter’).onItemReady() function.
Then i fill the data property and i call the forEachItem() function.
The events will not be duplicate.
example :
I call onItemReady function once with all events inside.
itemData is empty.
await $w("#rpter").onItemReady( ($item, itemData, index) =>{
$item("#img1").onClick( (event) => {
fActionEvent(index);
});
});
//
I use the forEachItem function to update the repeater.
await $w("#rpter").forEachItem( ($item, itemData, index) =>{
$item('#img1').src = itemData.imgSrc;
$item('#img1').fitMode = "fit";
});
Let me know if it helps.
Similar here, images inside repeaters no longer update the image when changed using .src. Although some pages with identical code still work OK. No idea what WIX have changed to make it happen. Pages work fine in preview mode.
@doc-oftd , @xcatouillard , @judeosborn , @yury-a-khokhlov
It seems that my website works fine now…
Could you confirm yours ?
It updates the tooltips OK, but the .src is still failing. I tried hiding and then showing it, but that makes no difference.
@doc-oftd , @xcatouillard , @judeosborn , @yury-a-khokhlov
yes it’s true… I tested on my mobile version website… and strangely… it works.
I checked on my computer… it doesn’t work!!!
Looks like we have a bug on our hands. Does anyone know what the best way is to report this? Do we wait until someone from the Wix team notices this post?
I am experiencing the same thing and it started midday (PST) February 23, 2023. I’ve noticed many of the same conditions as reported here.
Using Dynamic pages, I am programmatically changing the .src of an image based on an array of images fetched from an external API. This worked wonderfully until yesterday.
Likewise, for me it works fine in preview mode but not on the published site.
As well, and to rule out the API connection, I tested displaying an image by changing the .src value of an image to a sample, hard-coded external link from data in the API and that works just fine (showing the remote image). (Edit: It works as long as it is in the main " $w . onReady ( function () {". When assigning a remote link to the .src of an image deeper inside a function to display fetched images, it does not work even when the remote https address is hard coded).
i.e. this works:
$w . onReady ( function () {
$w ( ‘#image7’ ). src = “https://images.bo…”
this does not (even though in this test, I am not using the returned API data):
$w . onReady ( function () {
getRemoteData ( Filter )
. then ((returnedJsonData) => {
$w(‘#image7’).src = “https://images.bo…”;
Also, in my situation and outside of a repeater, one of my pages still works on my iphone, but not ipad, Mac or PC.
.
It will be great when this gets corrected.
@xcatouillard , @judeosborn , @yury-a-khokhlov , @doc-oftd
Here is a way to report a bug.
- To report the bug within the Wix Editor, go to the Velo Help menu, click “Give Velo Feedback”, and then click “Send bug report”.
I will use this when I’m be back at home.
I’ve made a support request. The .src command does update the image information as I’ve read it (using .src) and it has been changed. However it seems to be failing to refresh the image with the new picture and I can find no way of working around it other than never using .src to update an image anymore!
It stopped working for me as well. Nothing with .src works now. Hope wix sorts it out!
FWIW, I have now reworked my site to import the remote images into a Collection and use a Gallery for displaying them. This will not be sustainable for long as there are about a thousand images typically and they change regularly. I have automation to load the new ones but no elegant way to easily remove the unneeded ones.
The problem is still there for me. It pops up on both mobile and desktop versions.
Its happening though is quite random.
On rare occasions, the source of some images are changed as expected but I still can’t figure out what’s triggering the problem.
I feel like it depends on the order of execution of the code…
I’m going to report the bug as well.
Anyone know how long it takes Wix generally to fix things like this?
Is Wix aware of the issue? Anyone contacted wix and been told they are working in it?
2 sites affected here. Same symptoms (ok in preview, not ok on different device/browser combos live). 1st noticed Feb 23 on 1 site. FWIW: here’s text of bug report sent to Wix (removed page base URLs):
Have 2 sites affected by the issue(s) described by others at
All contexts are ok in preview. Wide range of device/browser variations in live:
/paintings (first noticed today)
-
#image (not in a repeater) : no worky on live with 1. chrome on laptop, 2. iPadPro Safari/Chrome (page not designed for mobile)
- images in repeaters on this page work fine
/about-us (first noticed Feb 23, would intermittently work, today consistently not working as noted below)
-
#staff repeater : ok in live on 1. iphone12p, 2. iPadPro Safari; not ok on 1. chrome laptop, 2. iPadPro Chrome
/staff (first noticed Feb 23, but consistently not working since then)
-
#image (not in a repeater) : not working on 1. chrome laptop, 2. iPadPro Chrome, Safari (page not designed for mobile)