Home › Forums › WoodMart support forum › Can’t Replace SVG Images
Can’t Replace SVG Images
- This topic has 3 replies, 2 voices, and was last updated 3 years, 6 months ago by
Elise Noromit.
-
AuthorPosts
-
February 16, 2022 at 3:24 pm #353550
atpd23ParticipantHello,
It seems I can’t replace uploaded SVG media by a new one with the same name. Let’s say I want to upload img.svg file which contains
fill
color value (I have opened the SVG file by a notepad and addedfill
attribute).Fill
is set to red and now I can upload the image. After uploading, the SVG file is displaying red as expected.Now I want to change it, I will change
fill
color to blue, remove the previous SVG image and upload a new one (withfill
set to blue) with the same img.svg name. Refresh the browser and it still displays the previous image (withfill
color red). I have tried to remove all site data, also tested it in a browser’s private mode, but without a success.It seems, when I upload any SVG file, I can’t replace it by a new one while the SVG image name is the same. It always prefer the first one uploaded, I could rename the image to something like img2.svg and it would work, but that doesn’t give me an explanation what I am doing wrong or if there is any issue. I am also using Safe SVG plugin.
Best Regards
February 17, 2022 at 12:04 am #353648
Elise NoromitMemberHello,
The problem is caused by SVG itself: some of your SVG images have styles that are applied to the whole page. As a result, the styles of one SVG icon influence the other. In order to solve this, you need to insert inline styles without classes.
You can open your SVG image in any text editor and manually change styles to inline like is shown on this screenshot https://prnt.sc/loz0mw.
If you create SVG in Adobe Illustrator we would suggest exporting SVG with appropriate CSS properties in the first place. During export from Illustrator choose style attributes. You can read more about resolving this issue in Illustrator here https://cobwwweb.com/inline-style-attributes-svg-elements.
Below I add an example file of the correct use of SVG styles.
Best Regards
February 17, 2022 at 3:35 pm #354011
atpd23ParticipantHello,
Thank you for the clear explanation. If I change style to inline, it already shows the correct color in the Media Library. But on the website side, there isn’t any change. Also SVG code is different than the one which should be. It seems as the previous SVG file was written into the core of the website and can’t be changed (note: tested in a private mode of my web browser, removed cookies, cached images, all browsing data). Please see the attached file for illustrative explanation.
I can successfully permanently delete an image and upload a new one, it shows in my Media Library, in WordPress’s “uploads” folder but there is a problem with my website frontend, which always displays the previous image, which was uploaded first – but this image was permanently deleted and also I can’t see it in the Media Library nor WordPress’s “uploads” folder.
Best Regards
Attachments:
You must be logged in to view attached files.February 18, 2022 at 11:23 am #354204
Elise NoromitMemberHello,
When you leave the file title the same, you need to clear the cache to see the difference. WoodMart does not influence the browser or site cache.
If you have any questions please feel free to contact us.
Best Regards
-
AuthorPosts
- You must be logged in to create new topics. Login / Register