Question

In my application I'm displaying images via REST that I've pulled from a library using a query similar to this:

http://localhost/_api/web/GetFolderByServerRelativeUrl('/PublishingImages')/Files

As I'm iterating through the results, I'd like to determine somehow if there are any renditions for the image that have been created, and iterate/call the renditions as well. For this application I'd only have access to the SharePoint REST API (no CSOM or server-side abilities, basically stuck with $ajax()).

I could change the initial call to get me the folders in publishing images as well if needed.

So has anyone done renditions in the SharePoint 2013 REST API? Basically I'm hoping for a block coming back from rest that would do something like this:

OriginalImage: OrigianalImage.jpg
Rendition1: OriginalImage.jpg?RenditionID=1
Rendition2: OriginalImage.jpg?RenditionID=2

etc....

Was it helpful?

Solution

You have preview images in the hidden _w/ folder and thumbnails in the _t/ but to fetch the rendition you'll need to use the RenditionID parameter

/PublishingImages/Stahp.jpg?RenditionID=2

This pattern will apply to any API you are using

You will find the id's in PublishingImageRenditions.xml

OTHER TIPS

Actually, call the file properties rest api, and you will see a tag with PublishingImageRendition{d} where d is the number of the rendition you define:

https://x.sharepoint.com/sites/sandbox2/_api/Web/GetFileByServerRelativeUrl('/sites/sandbox2/mylibrary/abc.123.jpg')/Properties

You'll get back something like this: PublishingImageRendition6=1;1972;2762;396;0;1220;1627 where the values map to the original values and define what the rendition should be:

  • [0]: rendition version
  • [1]: Source Image Width
  • [2]: Source Image Height
  • [3]: Crop Start X
  • [4]: Crop Start Y
  • [5]: Crop Width
  • [6]: Crop Height

Using those values, you can transform the image yourself...

(https://blog.mastykarz.nl/image-renditions-sharepoint-2013/)

Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top