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?
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?
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.
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:
// sample code for generating the article thumbnail URL
$strClientId = ""; // this is from the API key request form
// get the access token
$arrUserData = $objArticleEntity->getToken()->getResponse();
$strAccessToken = $arrUserData['access_token'];
// get the entity content URL
$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.
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.
Thanks Mike and Neil for the above.