Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

How to get URL of an Online Public Resource in a Web App

Avatar

Avatar
Springboard
MVP
Florian_Courgey
MVP

Likes

93 likes

Total Posts

87 posts

Correct Reply

19 solutions
Top badges earned
Springboard
Validate 1
Establish
Contributor
Ignite 1
View profile

Avatar
Springboard
MVP
Florian_Courgey
MVP

Likes

93 likes

Total Posts

87 posts

Correct Reply

19 solutions
Top badges earned
Springboard
Validate 1
Establish
Contributor
Ignite 1
View profile
Florian_Courgey
MVP

01-08-2018

Hi,

We upload our CSS+JS files and our images in Resources>Online>Public Resources. We would like to get the public URL (available when you select a Resource>tab Preview) from a javascript template and/or a web app.

We tried

xtk.fileRes.get(12435) // not found

xtk.fileRes.get("12435") // not found

xtk.fileRes.get(12435).GetURL() // not found

It would be nice to have

GetPublicURLFromResourceLabel("myLabelHere") // https://instance/res/1414135351.css

// or

ResourceFromLabel("myLabelHere").GetURL()

In short, how to convert a Public Resource to a Public URL?

Or maybe we should store our CSS in another place? What are the best practices for web development into Adobe Campaign?

Thank you

Florian

Adobe Campaign 7 - AC7 - build 8889

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Springboard
MVP
Florian_Courgey
MVP

Likes

93 likes

Total Posts

87 posts

Correct Reply

19 solutions
Top badges earned
Springboard
Validate 1
Establish
Contributor
Ignite 1
View profile

Avatar
Springboard
MVP
Florian_Courgey
MVP

Likes

93 likes

Total Posts

87 posts

Correct Reply

19 solutions
Top badges earned
Springboard
Validate 1
Establish
Contributor
Ignite 1
View profile
Florian_Courgey
MVP

08-08-2018

1. Use filename instead of md5: Go to Advanced and uncheck Unique file name:

File-Resource-URL-as-filename-instead-of-md5-hash.jpg

2. use xtk.fileRes.GetPublicFileResURL(😞

var publicResourceURL = xtk.fileRes.GetPublicFileResURL() + "favicon.png"; // http://your-instance-res-url/your_instance/favicon.png

Featured on https://floriancourgey.com/2018/08/modern-web-development-in-adobe-campaign/

Answers (1)

Answers (1)

Avatar

Avatar
Boost 1
Level 1
dirkwybe
Level 1

Likes

2 likes

Total Posts

1 post

Correct Reply

0 solutions
Top badges earned
Boost 1
View profile

Avatar
Boost 1
Level 1
dirkwybe
Level 1

Likes

2 likes

Total Posts

1 post

Correct Reply

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

01-10-2018

Hi Florian,

There is a function called getImageUrl, which does what you are looking for.

you can either pass the resource ID or internal name:

getImageUrl("myLabelHere") --> https://instance/res/1414135351.css

thanks,

Dirk