Demo for writing an Titanium application using Parse as a backend and Cloudinary as image backend for storing, applying transformations and serving of images.
For more details about Cloudinary: http://cloudinary.com/
For more details about Titanium development: http://www.appcelerator.com/developers/
For more details about Parse: https://www.parse.com/
- Sign up for a free Cloudinary account
- Register, download Titanium SDK, setup Titanium Studio and mobile SDKs
- Download or clone this repository into your titanium workspace
- Setup the Parse backend in 7 simple steps
- Copy the
app/lib/config.coffee.sample
file intoapp/lib/config.coffee
and modify the configuration within it to reflect your Cloudinary cloud name and your Parse Application ID and Javascript Key. - Import the project (File -> Import -> Titanium -> Existing Mobile Project -> Project directory -> Browse -> [Choose the cloudinary-titanium-parse-sample path])
- Run the application on an mobile device or a simulator (Run -> Run Configurations -> [Double click preferred run configuration] -> Run)
The application is composed of 4 top-level Alloy controllers (login
, list_photos
, show_photo
and upload_photo
), a generic grid view class (app/lib/grid_view
), and a few external libraries.
All code is written in CoffeeScript and compiled automatically by the titanium-assets plugin.
Invoked by alloy before anything else. It configures Cloudinary and Parse
The default controller that is openned by alloy. It creates and opens login
controller.
The Cloudinary API key and API secret are protected in Parse cloud code. They are not bundled in the application and are not accessible by any user - making the design more secure and protecting yours and your users' privacy and data integrity.
In order to upload in image from the application:
- A request to upload is sent by the application to Parse backend using a cloud function.
- The cloud function (by default,
sign_upload_request
) creates a signed request (using Cloudinary API parameters) and returns it to the application. - The application uploads the image to Cloudinary using the retrieved signed request. When the upload is complete, Cloudinary returns a signed result of the operation containing the image public_id, other identifiers required to access the image and metadata about the image (disk size, dimensions, etc...)
- The application saves the signed reference of the image to Parse backend.
- The Parse beforeSave filter verifies the authenticity of the saved reference and aborts the process if it's invalid.
Displays a Chuck Norris power icon fetched from the official Facebook profile and transformed by Cloudinary.
Login is done using Parse backend in doSubmit
function
Uses grid_view
class to display a grid of all items. The collection of images is managed and retrieved using Parse.Collection SDK class (app\lib\parse_photo_album.coffee
)
Also adds an additional (plus sign) image for uploading new images.
Uses:
app/lib/grid_view
library class - A basic framework for displaying a Backbone collection of items using alloy controllersgrid_main
controller - Handles whole grid behaviourgrid_child
controller - Handles each grid item behaviour
Displays a swipeable window with different transformations applied to the selected image
Uses:
image_tab
controller - Displays a cloudinary image using an identifier and a transformation object
Invokes native photo gallary to allow user to select an image to upload. Once the user selects an image, the upload process begins.
Cloudinary documentation
Cloudinary for Titanium
Cloudinary for Parse
You can open an issue through GitHub.
Contact us at [email protected]
Or via Twitter: @cloudinary
The sample has been tested on Android and iOS platforms. Due to browser limitations, mobile web won't work with cloudinary
- This project is released under the MIT license.