I want to Upload images to Public resources every morning. Is it possible to automate this process.

Avatar

Avatar
Validate 1
Level 1
Saket1
Level 1

Like

1 like

Total Posts

3 posts

Correct reply

0 solutions
Top badges earned
Validate 1
Boost 1
View profile

Avatar
Validate 1
Level 1
Saket1
Level 1

Like

1 like

Total Posts

3 posts

Correct reply

0 solutions
Top badges earned
Validate 1
Boost 1
View profile
Saket1
Level 1

03-03-2017

I want to Upload images to public resources at a regular interval of time are there any API's to this.

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Springboard
MVP
MarcelSzimonisz
MVP

Likes

103 likes

Total Posts

227 posts

Correct reply

56 solutions
Top badges earned
Springboard
Establish
Contributor
Give Back 25
Give Back 10
View profile

Avatar
Springboard
MVP
MarcelSzimonisz
MVP

Likes

103 likes

Total Posts

227 posts

Correct reply

56 solutions
Top badges earned
Springboard
Establish
Contributor
Give Back 25
Give Back 10
View profile
MarcelSzimonisz
MVP

08-06-2017

Hello,

i have done  script to upload photos to public resources from JS activity within workflow. You can add list of files and loop below script

var file = new File("path_to_file\\mont.jpg");

if(!file.exists)

     logError ("File '" + file.fullName + "' does not exists.");

var extension = /[^.]+$/.exec(file.name);

var md5 = HMACStr(file.name,"UTF-8","MD5");

if (!file.copyTo("path_to_adobe\\Adobe Campaign v6\\var\\res\\bootcamp\\" + md5 + "." + extension))

     logError ("File '" + file.fullName + "' was not copied");

var xmlString = '<fileRes alt="" codepage="0" height="0" name="owl.jpg" nature=""  publish="0" storageType="5" useMd5AsFilename="1" userContentType="0" version=""  width="0" xtkschema="xtk:fileRes"/>'

var fileRes = xtk.fileRes.create( new XML(xmlString));

fileRes.contentType="image/jpeg";

fileRes.label = "some_label"

fileRes.md5 = md5;

fileRes.fileName = "path_to_adobe\\Adobe\\Adobe Campaign v6\\bin\\..\\var\\res\\bootcamp\\" + md5 + "." + extension;

fileRes.originalName = "path_to_file\\Downloads\\mont.jpg";

fileRes.save();

Result after you run this javascript

khjkhjk.jpg

Marcel

Answers (8)

Answers (8)

Avatar

Avatar
Boost 1
Level 1
hamster_billy
Level 1

Likes

2 likes

Total Posts

2 posts

Correct reply

0 solutions
Top badges earned
Boost 1
View profile

Avatar
Boost 1
Level 1
hamster_billy
Level 1

Likes

2 likes

Total Posts

2 posts

Correct reply

0 solutions
Top badges earned
Boost 1
View profile
hamster_billy
Level 1

30-05-2017

We inherited a system which included a workflow, build by an Adobe engineer, to import images from a shared folder on the Campaign server as xtk:fileRes. There's a fundamental problem with trying to do this within Campaign itself, that it's not possible (as far as I can see in the docs, and confirmed by someone from Adobe Support) to calculate the md5 hash of a file - and thus the xtk:fileRes record you end up with is not the same as that which would have been created by uploading the same image in the UI. We don't know what the consequences of this are, but it certainly has potential for things to break.

I ended up writing a .NET app through which images (along with their md5 hash!) can be uploaded to a custom SOAP endpoint, which then creates the xtk:fileRes records - see the github project. The treatment of folders could still do with a bit of work - it doesn't create folders, or change the folder if the image already exists in a different one. But it works for our purposes, and may work for yours; or at least give you some useful ideas.

Avatar

Avatar
Affirm 25
Level 4
Deb007
Level 4

Likes

50 likes

Total Posts

86 posts

Correct reply

25 solutions
Top badges earned
Affirm 25
Boost 25
Applaud 5
Give Back 5
Validate 1
View profile

Avatar
Affirm 25
Level 4
Deb007
Level 4

Likes

50 likes

Total Posts

86 posts

Correct reply

25 solutions
Top badges earned
Affirm 25
Boost 25
Applaud 5
Give Back 5
Validate 1
View profile
Deb007
Level 4

08-08-2017

Hi Marcel,

Thanks a lot. The solution provided above worked fine for me.

Deb

Avatar

Avatar
Validate 1
Employee
Vapsy
Employee

Likes

370 likes

Total Posts

726 posts

Correct reply

342 solutions
Top badges earned
Validate 1
Boost 50
Boost 5
Boost 3
Boost 250
View profile

Avatar
Validate 1
Employee
Vapsy
Employee

Likes

370 likes

Total Posts

726 posts

Correct reply

342 solutions
Top badges earned
Validate 1
Boost 50
Boost 5
Boost 3
Boost 250
View profile
Vapsy
Employee

02-08-2017

Hi Marcel,

Your solution will work if there is only one frontal server.

If there are two servers, wfserver process will only run on the first one.

So, if you save it to file resources, the record wil get updated in the database but the actual file will only be published on the first server.

The second server will not receive it.

In a load balanced scenario, if this image is used in email, it will render on occasion if the GET call is sent to the first server. WHen it goes to second HTTP 404 will occur.

Please correct me if my understanding is wrong.

Regards,

Vipul

Avatar

Avatar
Boost 1
Level 1
pkrish61
Level 1

Like

1 like

Total Posts

5 posts

Correct reply

0 solutions
Top badges earned
Boost 1
View profile

Avatar
Boost 1
Level 1
pkrish61
Level 1

Like

1 like

Total Posts

5 posts

Correct reply

0 solutions
Top badges earned
Boost 1
View profile
pkrish61
Level 1

18-02-2021

xtk.fileRes.PublishIfNeededFromId(fileRes.id);

 

Use this after saving file and it will publish to all frontal servers.

Avatar

Avatar
Springboard
MVP
MarcelSzimonisz
MVP

Likes

103 likes

Total Posts

227 posts

Correct reply

56 solutions
Top badges earned
Springboard
Establish
Contributor
Give Back 25
Give Back 10
View profile

Avatar
Springboard
MVP
MarcelSzimonisz
MVP

Likes

103 likes

Total Posts

227 posts

Correct reply

56 solutions
Top badges earned
Springboard
Establish
Contributor
Give Back 25
Give Back 10
View profile
MarcelSzimonisz
MVP

04-08-2017

Hello Vipul,

yes thats good question you will need to publish images to all frontal servers as it would be done automatically when you are uploading resource via adobe. Thank you for pointing this out.

I think the one who wants this to be automated will figure it out somehow or I suppose it can be done differently at all.

Marcel

Avatar

Avatar
Springboard
MVP
MarcelSzimonisz
MVP

Likes

103 likes

Total Posts

227 posts

Correct reply

56 solutions
Top badges earned
Springboard
Establish
Contributor
Give Back 25
Give Back 10
View profile

Avatar
Springboard
MVP
MarcelSzimonisz
MVP

Likes

103 likes

Total Posts

227 posts

Correct reply

56 solutions
Top badges earned
Springboard
Establish
Contributor
Give Back 25
Give Back 10
View profile
MarcelSzimonisz
MVP

02-08-2017

Hello debabratat65073412​,

You can use file transfer activity

1270605_pastedImage_1.png

Marcel

Avatar

Avatar
Affirm 25
Level 4
Deb007
Level 4

Likes

50 likes

Total Posts

86 posts

Correct reply

25 solutions
Top badges earned
Affirm 25
Boost 25
Applaud 5
Give Back 5
Validate 1
View profile

Avatar
Affirm 25
Level 4
Deb007
Level 4

Likes

50 likes

Total Posts

86 posts

Correct reply

25 solutions
Top badges earned
Affirm 25
Boost 25
Applaud 5
Give Back 5
Validate 1
View profile
Deb007
Level 4

02-08-2017

Hi marcel.gent.86,

When I am running this code I could see that the File object from which we are trying to create a File Resource, should be placed in a path in server("/usr/local/neolane/nl6/var/partners/"). I am unable to find any activity to copy/upload the file to server path. If this understanding is correct can you please mention any suggestion to upload a file/image from local drive to the server.

Avatar

Avatar
Validate 1
Employee
Vapsy
Employee

Likes

370 likes

Total Posts

726 posts

Correct reply

342 solutions
Top badges earned
Validate 1
Boost 50
Boost 5
Boost 3
Boost 250
View profile

Avatar
Validate 1
Employee
Vapsy
Employee

Likes

370 likes

Total Posts

726 posts

Correct reply

342 solutions
Top badges earned
Validate 1
Boost 50
Boost 5
Boost 3
Boost 250
View profile
Vapsy
Employee

06-03-2017

There is one but I don't remember it now. However, it observes few concerns when there are more than one frontal servers.

It is something to be requested from Adobe PS and hence is out of scope for this forum.