html
customImageSrc
Returns the path to a custom sized image. The resulting image may be cropped to the aspect ratio requested.
path
(String) The path to an image. Generally imageObject.thumbnailPath.
key
(String) The key of an image. Generally imageObject.key.
width
(Int) The desired width of the image.
height
(Int) The desired height of the image.
Returns
(String) A relative path to the image.
Usage
var imageSource = ptg.html.customImageSrc(image.path, image.key, 800, 600);
customImageTag
Returns the html code of an image tag for a custom sized image. The resulting image may be cropped to the aspect ratio requested.
path
(String) The path to an image. Generally imageObject.thumbnailPath.
key
(String) The key of an image. Generally imageObject.key.
width
(Int) The desired width of the image.
height
(Int) The desired height of the image.
Returns
(String) An html image tag with a fully qualified url for the image.
Usage
var imageTag = ptg.html.customImageTag(image.path, image.key, 800, 600);
customImageLockSrc
Returns the path to a custom sized image while maintaining aspect ratio. The resulting image may not be the exact dimensions as requested but no cropping will be applied.
path
(String) The path to an image. Generally imageObject.thumbnailPath.
key
(String) The key of an image. Generally imageObject.key.
originalWidth
(Int) The width of the original (hi-res) image.
originalHeight
(Int) The height of the original (hi-res) image.
width
(Int) The desired width of the image.
height
(Int) The desired height of the image.
Returns
(String) A relative path to the image.
Usage
var imageSrc = ptg.html.customImageLockSrc(image.path, image.key, image.width, image.height, 700, 250);
customImageLockTag
Returns the html code of a custom sized image while maintaining aspect ratio. The resulting image may not be the exact dimensions as requested but no cropping will be applied.
path
(String) The path to an image. Generally imageObject.thumbnailPath.
key
(String) The key of an image. Generally imageObject.key.
originalWidth
(Int) The width of the original (hi-res) image.
originalHeight
(Int) The height of the original (hi-res) image.
width
(Int) The desired width of the image.
height
(Int) The desired height of the image.
Returns
(String) An html image tag with a fully qualified url for the image.
Usage
var imageTag = ptg.html.customImageLockTag(image.path, image.key, image.width, image.height, 700, 250);
imageSrc
Returns a fully qualified path for an image.
path
(String) The path to an image. Generally imageObject.thumbnailPath.
Returns
(String) A fully qualified url for the image.
Usage
var imageSource = ptg.html.imageSrc(image.path);
imageTag
Returns the html code with a fully qualified path for an image.
path
(String) The path to an image. Generally imageObject.thumbnailPath.
Returns
(String) An html image tag with a fully qualified url for the image.
Usage
var imageTag = ptg.html.imageTag(image.path);
swfCode
Returns html code (embed/object tags) for embedding an swf.
path
(String) The path to an swf.
width
(Int) The width for the object/embed tags.
height
(Int) The height for the object/embed tags.
bgcolor
(String) A hex value for the background color. Include the leading # sign.
Returns
(String) An html image tag with a fully qualified url for the image.
Usage
var embedCode = ptg.html.swfCode(slideshow.thumbnail.path, slideshow.thumbnail.key, 865, 570, '#fff');
image
addTags
Adds tags to the image specified and executes an optional callback function. The callback function gets passed back an image object.
id
(Int) The id of the image. Generally imageObject.id.
tags
(String) The tags to be added to this image. Separate multiple tags with a comma. Duplicate tags are automatically resolved.
callback
(String) An optional string which represents the name of a function to be executed. The function will be passed in an image object.
Usage
ptg.image.addTags(image.id, 'vacation,florida');
getImage
Requests a specified image and executes an optional callback function. The callback function gets passed back an image object.
identifier
(Mixed) The id or key of the image. Generally imageObject.id or imageObject.key.
callback
(String) An optional string which represents the name of a function to be executed. The function will be passed in an image object.
Returns
(String) A relative path to the image.
Usage
var imageSource = ptg.image.getImage(image.id);
- or -
var imageSource = ptg.image.getImage(image.key);
removeTags
Removes tags from the image specified and executes an optional callback function. The callback function gets passed back an image object.
id
(Int) The id of the image. Generally imageObject.id.
tags
(String) The tags to be removed from this image. Separate multiple tags with a comma.
callback
(String) An optional string which represents the name of a function to be executed. The function will be passed in an image object.
Usage
ptg.image.removeTags(image.id, 'hawaii,beach');
search
Executes a search on various criteria and executes an optional callback function. The callback function gets passed back an images object.
(Object) An object of search parameters. The property represents the search field and the value represents the criteria. The object can be passed inline. For example ptg.image.search({"tags":"vacation"}). Optional search fields are dateCreatedBegin, dateCreatedEnd, dateTaken, dateTakenBegin, dateTakenEnd and tags. Additional fields can be passed which include limit, offset and order.
callback
(String) An optional string which represents the name of a function to be executed. The function will be passed in an image object.
Usage
ptg.image.search({'tags':'vacation'}, 'alert');
transform
crop
Crops a specified image and executes an optional callback function. The callback function gets passed back an image object.
id
(Int) The id of the image. Generally imageObject.id.
x1
(Int) The top left x-coordinate to start the crop from.
y1
(Int) The top left y-coordinate to start the crop from.
x2
(Int) The bottom right x-coordinate to start the crop from.
y2
(Int) The bottom right y-coordinate to start the crop from.
callback
(String) An optional string which represents the name of a function to be executed. The function will be passed in an image object.
Usage
ptg.image.transform.crop(image.id, 10, 10, 500, 600);
greyscale
Greyscales a specified image and executes an optional callback function. The callback function gets passed back an image object.
id
(Int) The id of the image. Generally imageObject.id.
callback
(String) An optional string which represents the name of a function to be executed. The function will be passed in an image object.
Usage
ptg.image.transform.greyscale(image.id);
restore
Restores a specified image back to it's original state and executes an optional callback function. The callback function gets passed back an image object.
id
(Int) The id of the image. Generally imageObject.id.
callback
(String) An optional string which represents the name of a function to be executed. The function will be passed in an image object.
Usage
ptg.image.transform.restore(image.id);
rotate
Rotates a specified image and executes an optional callback function. The callback function gets passed back an image object.
id
(Int) The id of the image. Generally imageObject.id.
degrees
(Int) The amount to rotate the image clockwise in degrees. Accepted values for degrees are 90, 180 and 270.
callback
(String) An optional string which represents the name of a function to be executed. The function will be passed in an image object.
Usage
ptg.image.transform.rotate(image.id, 90);
sepia
Applies a sepia effect to a specified image and executes an optional callback function. The callback function gets passed back an image object.
id
(Int) The id of the image. Generally imageObject.id.
callback
(String) An optional string which represents the name of a function to be executed. The function will be passed in an image object.
Usage
ptg.image.transform.sepia(image.id);
zoom (EXPERIMENTAL)
Zooms in on a specified image and executes an optional callback function. The callback function gets passed back an image object.
id
(Int) The id of the image. Generally imageObject.id.
step
(Int) The amount to zoom. Possible values are between 1 and 5.
callback
(String) An optional string which represents the name of a function to be executed. The function will be passed in an image object.
Usage
ptg.image.transform.zoom(image.id, 3);
result
current
Returns the current element of the specified object.
data
(Object) The object you would like to access. Generally imageObject or slideshowObject.
Returns
(Mixed) The currently indexed element in the object.
Usage
var currentImage = ptg.result.current(imagesObject);
next
Returns the next element of the specified object and advances the internal pointer.
data
(Object) The object you would like to access. Generally imageObject or slideshowObject.
Returns
(Mixed) The next indexed element in the object. This advances the pointer so a subsequent call to result.next returns the next indexed element.
Usage
var nextImage = ptg.result.next(imagesObject);
Resets the internal pointer.
Some description
Usage
ptg.result.reset();
totalRows
Returns the total number of rows returned to the object. This is not the same as the length of the object. Primarily used to get the total number of rows for a search omiting any offsets and limits.
data
(Object) The object you would like to access. Generally imageObject or slideshowObject.
Returns
(Int) The total number of rows in the object. This exists for imageObject and slideshowObject.
Usage
var totalImages = ptg.result.totalRows(imageObject);
slideshow
embed
Returns the html code to embed a slideshow into an html document.
params
(Object) An object with a property named key or tags depending on what you would like the embedded slideshow to contain.
Returns
(String) Html for embedding a slideshow object.
Usage
var slideshowCode = ptg.slideshow.embed(slideshow.id);
- or -
var slideshowCode = ptg.slideshow.embed(slideshow.key);
search
Executes a search on various criteria and executes an optional callback function. The callback function gets passed back a slideshows.
params
(Object) An object of search parameters. The property represents the search field and the value represents the criteria. The object can be passed inline. For example ptg.slideshow.search({"tags":"vacation"}). Optional search fields are key, id and tags. Additional fields can be passed which include limit, offset and order.
Usage
ptg.slideshow.search({'tags':'vacation'}, 'alert');
user
getTags
Returns the users tags. The callback function gets passed back a tags object.
Usage
ptg.user.getTags();
image
The image object contains the following properties.
  • id
  • userId
  • key
  • tags
  • name
  • description
  • size
  • width
  • height
  • rotation
  • views
  • cameraMake
  • cameraModel
  • originalPath
  • thumbnailPath
  • dateCreated
  • dateModified
  • dateTaken
images
images is an array of image objects. Use result.next to loop over an images object.
Example
while(anImage = ptg.result.next(images))
{
  // alert(anImage.name);
}
slideshow
The slideshow object contains the following properties.
  • id
  • userId
  • key
  • tags
  • name
  • frames
  • views
  • thumbnail (object)
    • path
    • key
  • viewsComplete
  • dateCreated
  • dateModified
slideshows
slideshows is an array of slideshow objects. Use result.next to loop over a slideshows object.
Example
while(aSlideshow = ptg.result.next(slideshows))
{
  // alert(aSlideshow.name);
}
tag
The tag object contains the following properties.
  • tag
  • tagCount
tags
tags is an array of tag objects. Use result.next to loop over a tags object.
Example
while(aTag = ptg.result.next(tags))
{
  // alert(aTag.tag);
}