Gallery Extended 2.1 Form

The GX form allows your users to submit images into your photo galleries. More than one image can be submitted at once. In most cases you will have this form in a template that gets embedded into your other site templates. This way users can stick images to blog entries, comments and such like putty.

{exp:gallery_extended:form}

Parameters

form_id=

form_id="this_form_id"

The 'form_id' parameter allows you to declare the id of the form in order to control it with Javascript.

form_name=

form_name="this_form"

The 'form_name' parameter allows you to declare the name of the form in order to control it with Javascript.

gallery_name=

gallery_name="gallery name"

The 'gallery_name' parameter is a required parameter. It tells GX which gallery to load images into.

onsubmit=

onsubmit="return some_javascript();"

The 'onsubmit' parameter allows you to execute Javascript functions at form submission.

override_resize=

override_resize="yes"

EE's gallery module tries to create medium and thumbnail sized versions of the images that users upload. Depending on the image library your install of EE uses, resizing of GIF type images may not be possible. If a GIF image is uploaded and the 'override_resize' parameter is not set to yes, an error message will occur.

template=

template="template_group/template_name"

When you provide the 'template' parameter, you tell GX what template to use to format messages returned by the module for successful and unsuccessful actions. You will most likely be using the 'template' parameter to enable AJAX functionality.

Available in the template that you refer to in the parameter are two conditionals and one variable. {if success}{/if} will evaluate to true if the submission action is successful. {if failure}{/if} will evaluate to true if the submission fails for some reason. And {message} will return the message from GX indicating the details of a successful or unsuccessful action.

related_id=

related_id="{entry_id}"

The 'related_id' parameter allows you to associate the id of a blog entry or a comment entry or a member id or whatever with the images uploaded. Often the form will site in a template that you embed into another temp

Variable Pairs

category_menu

This variable pair is used to create a category menu for your users to choose from in order to categorize their image submission. These variables are available inside the tag par:

{cat_description} {cat_id} {cat_name}

<select name="cat_id">
{category_menu}
<option value="{cat_id}">{cat_name}
{/category_menu}
</select>

Form Fields

allow_comments

Your users can determine whether comments are allowed on the images they upload.

<input type="checkbox" name="allow_comments" value="y" />

caption

Collect captions for uploaded images

cat_id

Your users can assign a category to the image they upload. See the category_menu variable pair above.

custom_field_one

Your users can record values for the photo gallery custom fields numbered one through six.

<input type="text" name="custom_field_one" value="" />
<input type="text" name="custom_field_two" value="" />
<input type="text" name="custom_field_three" value="" />
<input type="text" name="custom_field_four" value="" />
<input type="text" name="custom_field_five" value="" />
<input type="text" name="custom_field_six" value="" />

entry_date

Users can submit entry dates in order to override the default date recorded for image uploads.

image1

You can allow users to submit as many images at the same time as you like. Just add as many fields of type 'file' as necessary. Name each field sequentially like 'image1', 'image2', 'image3'.

<input type="file" name="image1" />
<input type="file" name="image2" />
<input type="file" name="image3" />

status

Users can control the status of a submitted entry by using a status field.

title

Collect a title for image uploads

userfile

This is a deprecated field used in GX1.0.

Examples

Below is an example of a Photo Stand-Alone Entry Form that will post photos to a photo gallery.

{exp:gallery_extended:entry_form gallery_name="Photo Gallery" return="template_group/template" override_resize="no"}

<div class="defaultBold" >File:</div>
<input type="file" class="form" name="image1" size="35" />

<div class="defaultBold" >Title:</div>
<input type="text" class="form" size="75" maxlength="100" name="title" value="" />

<div class="defaultBold" >Custom Field 1:</div>
<input type="text" name="custom_field_one" class="form" size="75" maxlength="100" value="" />

<div class="defaultBold" >Caption:</div>
<textarea name="caption" cols="75" rows="5" class="form" id="caption"></textarea>

<select name="cat_id">
{category_menu}
<option value="{cat_id}">{cat_name}
{/category_menu}
</select>

<input name="submit" type="submit" class="form" value=" Upload Photo " />

<input type="hidden" name="apply_watermark" value="y" />
<input type="hidden" name="allow_comments" value="y" />
<input type="hidden" name="status" value="o" />
<input type="hidden" name="entry_date" id="entry_date" value="{current_time format="%Y-%m-%d %h:%i %A"}" />

{/exp:gallery_extended:entry_form}

Below is an example of a Photo Stand-Alone Entry Form that is linked to via entry ID in the URL (3rd segment), which will related to that weblog entry. The only difference is adding the related_id and type parameters.

{exp:gallery_extended:entry_form gallery_name="Photo Gallery" related_id="{segment_3}" type="weblog" return="template_group/template" override_resize="no"}

<div class="defaultBold" >File:</div>
<input type="file" class="form" name="image1" size="35" />

<div class="defaultBold" >Title:</div>
<input type="text" class="form" size="75" maxlength="100" name="title" value="" />

<div class="defaultBold" >Custom Field 1:</div>
<input type="text" name="custom_field_one" class="form" size="75" maxlength="100" value="" />

<div class="defaultBold" >Caption:</div>
<textarea name="caption" cols="75" rows="5" class="form" id="caption"></textarea>

<select name="cat_id">
{category_menu}
<option value="{cat_id}">{cat_name}
{/category_menu}
</select>

<input name="submit" type="submit" class="form" value=" Upload Photo " />

<input type="hidden" name="apply_watermark" value="y" />
<input type="hidden" name="allow_comments" value="y" />
<input type="hidden" name="status" value="o" />
<input type="hidden" name="entry_date" id="entry_date" value="{current_time format="%Y-%m-%d %h:%i %A"}" />

{/exp:gallery_extended:entry_form}