Gallery2:Embedding - Gallery Codex
Personal tools

Gallery2:Embedding

From Gallery Codex

Embedding Gallery 2

Gallery 2 can be embedded seamlessly into your website. While you can customize an existing theme to make G2 match the look and feel of your website, you can also functionally integrate G2 into your website. G2 is designed to be easily embedded in other applications and offers an interface such that your website / PHP-driven application can talk to it.

Visual vs. Functional Integration

If all you need is to visually embed G2 in your website, e.g. by adding your own menu at the top / on the left / right or putting G2 in the center of a subpage of your website, then you can just edit the main theme templates in themes/matrix/templates/ and by adjusting the CSS to make sure that the font size and the colors match.

See: Theme Guide | How to - Visual Integration

If you also want to place some random images of G2 on other pages of your website, you can use the external imageblock from the imageblock module.

If visual embedding is not enough and you need to integrate G2's user management and authentication system and other parts with another PHP application, you can do that by using G2's GalleryEmbed class which is an interface between G2 and the application in which G2 should be embedded in.

Existing Integrations

Thanks to dedicated integration developers there are some more or less complete integrations available. For most of these you need to separately install Gallery 2 and the other application (CMS, portal, forum, wiki, ...) and then connect the two by using the integration for that application. For most applications you can use a module/extension/plugin, some less elaborate applications are not that modular and require that you edit some files. But you should never have to edit G2 files.

See: List of Available Integrations

Embedding Gallery in Other Applications

Gallery is designed specifically to manage your multimedia online. Gallery is not a content management system or a blog or a website editor. However, there's no reason why Gallery can't be the multimedia management portion of a much larger system which does much more context content management or blogging, etc. Many such systems focus on their core competency and provide a very weak multimedia management system. Gallery is designed to work within those larger systems and provide the functionality that they lack.

How we actually go about embedding Gallery into another program depends heavily on which program we are going to work with. More and more PHP based applications are modular and for these you can integrate G2 just by installing G2, the other application and additionally a module in that other application that integrates / wraps G2 into that application.

One of the most important goals when writing a (G2) integration should always be to make sure that no files have to be edited / replaced by the user. Only a very modular approach ensures that the user can maintain both applications independentely and upgrade quickly when a new (security) release is available for any of the 3 components (G2, emApp, and the integration).

See:

Also see: Embedding Development Roadmap

Short URLs in Embedded G2

Enabling short URLs (rewrite module) in embedded G2 is often not that easy. Therefore we have documented the necessary steps.

See: Configuring URL Rewrite for Embedded G2

Code Snippets

See: GalleryEmbed related Code Snippets