2

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....

0

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

  • It seems kinda silly to do it I know, but was hoping somewhere I'd get a block in REST back with something like: Image: OriginalImage.jpg Rendition 1: OriginalImage.jpg?RenditionID=1 Rendition 2: OriginalImage.jpg?RenditionID=2 Rather than having to guess each rendition is for each image. As the images being accessed by API can have a varying number of Renditions. – tekiegreg Mar 18 '15 at 19:52
  • 2
    That wont be possible over REST as far as I know – Eric Herlitz Mar 18 '15 at 20:22
  • I don't there is a way to select an image rendition – EasyE Sep 3 '16 at 0:31
1

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/)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.