Gigya Job Openings

accounts.showMyPhotoUI

Skip to end of metadata
Go to start of metadata

Description

This method displays the My Photo plugin, which enables users to view their account photo and to upload a new photo. 

Note: If you plan on integrating Gigya's Accounts API, we highly recommend reading the Registration-as-a-Service Guide. Registration-as-a-Service (RaaS) is a premium platform that requires separate activation. If RaaS is not part of your site package, please contact Gigya by filling in a support form through the Console. You can access the support page by clicking Support on the upper menu after logging into the Gigya Console.

 

The My Photo plugin may be activated in "display" mode, which only allows displaying the current photo if it exists, or "upload" mode, which also allows photo uploading (see parameters below). The following example shows the My Photo plugin in "upload" mode, for a user who has a profile picture.

The following is an example of the My Photo plugin being used in a new user's profile screen. The user does not have a photo or a thumbnail photo in their account, and therefore the plugin displays a default photo.

 

Unable to render {include} The included page could not be found.

 

Parameters

The following table lists the available parameters:

RequiredNameTypeDescription
containerID string An ID of a <DIV> element on the page in which you want to display the plugin.
If this parameter is not provided then the plugin will be displayed as a popup at the center of the page. Please refer to Dialog or Embedded section for extended explanation.
width integer Determines the width you desire for the plugin.
height integer Determines the height you desire for the plugin.
captionText string Sets the caption text. This parameter is relevant only when the plugin is in a popup mode (i.e., if the containerID/container parameter is not provided). If the plugin is embedded in the page then the caption is not presented.
context object A reference to a developer created object that will be passed back unchanged to the event handlers of any event triggered as a consequence of using this plugin. The context object will be passed as one of the fields of the eventObj received by the event handler (see extended explanation in the Plugin Events and in the Global Event Triggered sections below).
modestringThe mode in which the plugin should function. Possible values are:
  • "display" (default): The plugin only displays the user's account photo.
  • "upload": The plugin also enables the user to upload a photo.
onLoadfunction refA reference to an event handler function that will be called when the plugin has finished drawing itself.
onErrorfunction refA reference to an event handler function that will be called when an error occurs.

 

Events

An Event Handler is a JavaScript function with the following signature:

functionName(eventObj)

The single argument, eventObj, contains information about the event and has different fields for different events.

 

Registering Event Listeners

Gigya's events are divided into two types - plugin events and global events. To register a handler for a plugin event, pass the event handler method name as an argument of the method that generates the plugin.
For example:

function errorHandler(eventObj) {
    alert("failed with error" + eventObj.eventName);
    //Some error handling
}

gigya.accounts.showMyPhotoUI ({ 
    onError:errorHandler
   }
);

Registering to global events is done by calling the addEventHandlers method.

 

Event Data

The following tables specify the list of fields available in the eventObj for each event.

Note: In some cases the event handler function may return a Boolean value. This is specified below each table.

 

onError Event Data

FieldTypeDescription
   
eventName string The name of the event.
source string The source plugin that generated this event. The value of this field is the name of the plugin's API method, e.g., 'showLoginUI', 'showCommentsUI', etc.
contextobject Any user defined data passed as a value of the context parameter by the application to the API method, it will be returned as an accessible property in the response. If no context parameter was passed, it will not be returned.

 

onLoad Event Data

FieldTypeDescription
   
eventName string The name of the event.
source string The source plugin that generated this event. The value of this field is the name of the plugin's API method, e.g., 'showLoginUI', 'showCommentsUI', etc.
contextobject Any user defined data passed as a value of the context parameter by the application to the API method, it will be returned as an accessible property in the response. If no context parameter was passed, it will not be returned.

 

Code Sample

var params = {
   containerID: 'accountphoto',
   mode: 'edit'
}

gigya.accounts.showMyPhotoUI(params);

 

Additional Information

iPhone Photo Orientation

When Gigya receives a photo, it is uploaded in the orientation it was taken, so, for instance, on an iPhone that was sideways when the photo was captured, if this photo is uploaded to Gigya prior to having it's orientation corrected, it will appear side-ways or upside down in the user's profile. See https://www.businessinsider.com/heres-why-your-iphone-photos-sometimes-appear-upside-down-2014-10 for more information.

 

 

 

 

  • No labels