Try our conversational search powered by Generative AI!

Image Replacement

Vote:
 

I would like to replace all instances of an image currently on the website with a new image but with a different name. 

Example:  I have a client that has 5 products in their product line that are updated with new names each year.  Right now we are replacing the old style with the new style but naming the new style with the old styles' name.  We are globalizing the site and things are going to get very confusing very fast - with different countries offering different models with different style names. 

Is there a way to replace a current style with a new one with a different file name? 

#150867
Jun 30, 2016 16:38
Vote:
 

Hi,

which version of Episerver are you using? And how have you currently selected that image?

#150871
Jul 01, 2016 0:35
Vote:
 

I believe 9.1.  Screenshot below.
The image is just sitting in the Products media folder.  

EPIserver version screenshot

#150917
Jul 01, 2016 16:41
Vote:
 

Hi,

Let's say that the old image has the ID of 9 and the new has the ID of 10

Either you could be really extreme and change all rows in tblContentProperty where ContentLink = id of old image with the value of the new image.
UPDATE tblContentProperty SET ContentLink = 10 WHERE ContentLink = 9

But normally changing the database is not really recommended if you can solve it with the API.

Here's an example of how you could do that using Episerver's API: https://github.com/alfnilsson/episerverutils/blob/master/ImageReplacer.cs

#150928
Jul 03, 2016 23:58
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.