明壁幕府忍法帳 > Aptana Index > Home > Mobile Backend Services > Mobile Backend Services How-tos > Photo Uploading and Resizing

2018.08.24 Ver.10 (2018.11.16)

Photo Uploading and Resizing

Mobile Backend Services provides a great amount of flexibility when creating photo objects, or adding photos to other objects.

Custom photo sizes

App developers can specify a custom set of photo sizes by specifying the photo_sizes[<name>]=<width>x<height> parameter up to five times such as:

1
2
3
4
photo_sizes[preview]=100x100#
photo_sizes[android]=800x480
photo_sizes[iphone]=960x640
photo_sizes[ipad]=1024x768

To specify a size that results in a square image, give the same width and height along with a # immediately after, as shown above.

You may specify the photo_sizes parameter when creating or updating a Photos object or when adding a photo with the Users or Places create or update method.

The resized images are generated asynchronously, so the API or SDK call returns immediately with a response showing photo metadata:

Note that in the above response processed=false. This indicates that the photo is still processing in the background. Once the photo has been processed, the processed flag will be set to true and the URLs to access the photo are shown:

Synchronous photo uploading

You can also specify photo sizes to be processed synchronously during the create or update calls for photos and other objects with attached photos. This can be useful for immediately showing a thumbnail of the photo that was just uploaded. Specify photo_sync_sizes[]=<size name> one or more times in the request. The response will contain URLs for the original photo, plus the size or sizes which were processed synchronously. The property processed will be false until all processing has been completed. This feature may be used with either the default photo sizes or custom photo sizes.

After processing, all photo sizes will be available and processed=true will be set.

Deprecated behavior

ACS applications used to create the following default photo sizes when a photo was created:

Size Name
Max Width
Max Height
Aspect Ratio
square_75 75 75 square
thumb_100 100 67 original
small_240 240 160 original
medium_500 500 333 original
medium_640 640 427 original
large_1024 1024 683 original