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 images linked to an article while getting metadata.

Avatar

Avatar
Validate 1
Level 2
digitalr3317510
Level 2

Like

1 like

Total Posts

11 posts

Correct Reply

2 solutions
Top badges earned
Validate 1
Boost 1
Affirm 1
View profile

Avatar
Validate 1
Level 2
digitalr3317510
Level 2

Like

1 like

Total Posts

11 posts

Correct Reply

2 solutions
Top badges earned
Validate 1
Boost 1
Affirm 1
View profile
digitalr3317510
Level 2

02-11-2015

Can you please advise us on the following query regarding the images linked to an article? 

We can get meta data for an article by using getMetadata(). Is there a way to get the images(image urls) for article image, social sharing image linked to the article?

Thanks.

Replies

Avatar

Avatar
Boost 50
Employee
Neil_Enns_-_Ado
Employee

Likes

81 likes

Total Posts

654 posts

Correct Reply

252 solutions
Top badges earned
Boost 50
Boost 5
Boost 3
Boost 25
Boost 10
View profile

Avatar
Boost 50
Employee
Neil_Enns_-_Ado
Employee

Likes

81 likes

Total Posts

654 posts

Correct Reply

252 solutions
Top badges earned
Boost 50
Boost 5
Boost 3
Boost 25
Boost 10
View profile
Neil_Enns_-_Ado
Employee

02-11-2015

Hi,

You asked this same question in the Digital Publishing Suite forum where it was answered: How to get images linked in an article while getting metadata?. Are you asking the question for DPS 2015 content?

Neil

Avatar

Avatar
Validate 1
Level 2
digitalr3317510
Level 2

Like

1 like

Total Posts

11 posts

Correct Reply

2 solutions
Top badges earned
Validate 1
Boost 1
Affirm 1
View profile

Avatar
Validate 1
Level 2
digitalr3317510
Level 2

Like

1 like

Total Posts

11 posts

Correct Reply

2 solutions
Top badges earned
Validate 1
Boost 1
Affirm 1
View profile
digitalr3317510
Level 2

03-11-2015

Hi Neil,

Yes by mistake I had added that question in Digital Publishing Suite forum. But I need to know the way to retrieve the images for DPS 2015 content.

Thanks.

Avatar

Avatar
Boost 5
Employee
mikecyang
Employee

Likes

10 likes

Total Posts

54 posts

Correct Reply

23 solutions
Top badges earned
Boost 5
Boost 3
Boost 10
Boost 1
Affirm 5
View profile

Avatar
Boost 5
Employee
mikecyang
Employee

Likes

10 likes

Total Posts

54 posts

Correct Reply

23 solutions
Top badges earned
Boost 5
Boost 3
Boost 10
Boost 1
Affirm 5
View profile
mikecyang
Employee

03-11-2015

Hi,

The socialSharing image URL is part of the entity metadata, in the field "socialShareUrl":

// sample code

$objArticleEntity = new Article($arrCredentials, $arrParameters, $arrEndpoints);

$arrArticleMetadata = $objArticleEntity->getMetadata()->getResponse();

$strSocialSharingUrl = $arrArticleMetadata['socialSharingUrl'];

The thumbnail image URL can be generated by using the following:

https://pecs.publish.adobe.io/publication/{{publication-id}}/{{entity-type}}/{{entity-name}}/content...

// sample code for generating the article thumbnail URL

$strClientId = ""; // this is from the API key request form

// get the access token

$objArticleEntity = new Article($arrCredentials, $arrParameters, $arrEndpoints);

$arrUserData = $objArticleEntity->getToken()->getResponse();

$strAccessToken = $arrUserData['access_token'];

// get the entity content URL

$arrArticleMetadata = $objArticleEntity->getMetadata()->getResponse();

$strArticleContentUrl = $arrArticleMetadata['_links']['contentUrl']['href'];

// generates the thumbnail URL

$strThumbnailUrl = 'https://pecs.publish.adobe.io' + $strArticleContentUrl + "?api_key=" + $strClientId + "&user_token=" + $strAccessToken;

Please note that the thumbnail URL is only valid for 48 hours: the thumbnail URL requires the access token and the access token is valid for 48 hours.

Just in case: the $arrCredentials, $arrParameters, $arrEndpoints are variables generated by the PHP API examples.

- Mike

Avatar

Avatar
Boost 50
Employee
Neil_Enns_-_Ado
Employee

Likes

81 likes

Total Posts

654 posts

Correct Reply

252 solutions
Top badges earned
Boost 50
Boost 5
Boost 3
Boost 25
Boost 10
View profile

Avatar
Boost 50
Employee
Neil_Enns_-_Ado
Employee

Likes

81 likes

Total Posts

654 posts

Correct Reply

252 solutions
Top badges earned
Boost 50
Boost 5
Boost 3
Boost 25
Boost 10
View profile
Neil_Enns_-_Ado
Employee

03-11-2015

Note that Mike's response is for a server-side solution. There is no API to get this information from within article content in the viewer.

Neil

Avatar

Avatar
Validate 1
Level 2
digitalr3317510
Level 2

Like

1 like

Total Posts

11 posts

Correct Reply

2 solutions
Top badges earned
Validate 1
Boost 1
Affirm 1
View profile

Avatar
Validate 1
Level 2
digitalr3317510
Level 2

Like

1 like

Total Posts

11 posts

Correct Reply

2 solutions
Top badges earned
Validate 1
Boost 1
Affirm 1
View profile
digitalr3317510
Level 2

03-11-2015

Thanks Mike and Neil for the above.