Updating template image urls

garyn85607551

05-09-2019

Hi,

I'm looking to see how I can change/update all image urls globally (change the the domain reference aspect) in all templates without manually updating them individually. Currently there are 300+ in various location so manual updating the HTML will take a laborious while.

Is there any approach or solution to this? I have considered using javascript but haven't located anyway specific for my needs

Any assistance appreciated

Many thanks....Gary

Accepted Solutions (1)

Accepted Solutions (1)

Jean-Serge_Biro

MVP

06-09-2019

Hi Garyn,

The basic idea is to achieve a workflow, with firstly a Query activity then (or directly) a Javascript queryDef for selecting the expected deliveries and getting the html content and the all the content type you manages (facebook, line, pdf, MMS, in which URL images can exist). Normally raw text and SMS are not concerned.

The expected deliveries  can be all deliveries or the ones expected such as the one being edited, the model deliveries, keeping the completed deliveries as is, for far easier stuff.

So in the queryDef Javascript activity node contains at least the html content.

<node expr="[content/html/source]" alias="@contentHtml"/>

In the result query loop, manage the result.@contentHtml for substring/replace string based on img element type of the DOM and src change of subdomain1 by subdomain2 (Javascript methods).

Then for each delivery item, save the entity delivery  (or do it in a whole with an array for contentHtml new values and a writeCollection API call, at the end).

But it is not enough, except if deliveries are in editing mode or are templates models.
Otherwise, if the deliveries have been sent or images published.
So not only the html must be changed but also images uploaded on the new server, right ? Or does Adobe team do the move for you?


Also take care of the delivery uploadImages parameter, if set, it overloads the default nms:option for image resources location (see the Deployment wizard for your value).

Regards
J-Serge

Answers (3)

Answers (3)

Jean-Serge_Biro

MVP

05-09-2019

Hi Garyn,

Please may you elaborate a bit?

As far as I understand, you need to replace only the domain part for URL with full path, not relative path.
Such as https://domain1/XXXanditsparameters by https://domain2/anditsparameters.

And you need to do it in the html, but do you need to do it in the trackingUrl and trackingUrlInfo tables?

If you need to change in html and do manually republish templates/deliveries and the tracking urls as well when it is useful for further deliveries sending, I mean, deliveries in edition mode, no problem.
But if you need to update data automatically for past deliveries, it is other stuff, more complex, though possible.

If it is your own domains that you manage, you can also do it an easy way, with DNS alias declaration or with vhosts rules (at the http server). So in that case, nothing to do in Adobe Campaign itself
It is the way that it is managed for web sites, when a domain or subdomain must be replaced by another ones, without changing all the html pages and specific code (JS/php/.NET/Java etc).

Regards.
J-Serge

garyn85607551

10-09-2019

Hi Jean-Serge,

Thanks for the information. I'm currently reviewing your details and hoping this approach works. It's fairly new to me so fingers crossed. As regards the imagery on the server, yes we are working with Adobe to handle that.

I may come back at some point

Cheers....Gary 

garyn85607551

05-09-2019

Hi,

To keep it simple at this stage...the domain change will be something like from https://xxx.example.com/img/example1.png to https://yyy.example.com/img/example1.png on all existing delivery templates created. The manual way looks like to edit all 300+ templates manually and change the source HTML references for <img src="....." /> which I want to avoid.

As regards the domain while we own the TLD domain the DNS for the sub-domain is pointing to Adobe who host the SSL so need to avoid that aspect and unlikely to change.

Any information/guidance appreciated

Many thanks....Gary