Gallery3:Modules:embeditem - Gallery Codex
Personal tools

Gallery3:Modules:embeditem

From Gallery Codex

Description

Allows Gallery 3 photo images or photo or album fields to be embedded in external sites based on the item id. Using the item id allows items to be moved to different albums without breaking links to the item.

Installation

Unpack contents into modules folder. Rename the folder embeditem. Activate the module: Login -> Admin -> Modules. Check the box next to the module Embed Item. Click 'update' at the bottom of the page.

Usage

    http://EXAMPLE.com/gallery3/index.php/embeditem/type/argument/item_id

item_id is the id number of the photo or album.

type

  • field - name of any item field
      argument
    • title
    • description
    • type (album/photo/movie)
    • created, etc.
  • image - item image
      argument
    • thumb - thumbnail size image
    • resize - resized image size
  • imageurl - item's image url
      argument
    • thumb - thumbnail size image
    • resize - resized image size

Examples

Album or Photo fields:

    http://EXAMPLE.com/gallery3/index.php/embeditem/field/title/10

Where title is the field name and 10 is the item id number. This will return the title of item 10.

Album or Photo images:

    http://EXAMPLE.com/gallery3/index.php/embeditem/image/thumb/10

Where thumb is the image size and 10 is the item id number. This will return the thumbnail image of item 10.

Album or Photo image urls:

    http://EXAMPLE.com/gallery3/index.php/embeditem/imageurl/resize/10

Where resize is the image size and 10 is the item id number. This will return the url of the resized image of item 10.

To embed an item image on a page of an external website add the following code to the page:

For HTML

    <img src="http://example.com/gallery3/embeditem/image/resize/10">

For PHP

    <?php
         $value = file_get_contents("http://example.com/gallery3/embeditem/imageurl/resize/10");
         print '<img src="' . $value . '" />';
    ?>

Discussion

Discussion about this module, including bugs and feature requests, can be found on the forums at http://galleryproject.org/node/101254

Notes

To find the item id number, users with proper permissions can access the context menu for the photo or album and find the item id number in the links of the menu items.

Example: Photo context menu item "Edit this photo" links to http://example.com/gallery/quick/form_edit/5?from_id=2 where 5 is the item id number.

For the more adventurous, your Gallery theme can be modified to display the item id. I include the item id in the <img> title attribute of the image thumbnail for users with edit permission so that the item id appears when they hover over the thumbnail.

ToDo

  • Add urls to embedlinks module
  • Add support for movies
  • Add item id to item display in gallery
  • Add field "all" to retrieve all fields delimited
  • Add redirect for moved items

Version history

version 1.0

  • Initial release