About Image Extra
This module allows you to add additional information to an image (for example: title, description, link, orientation and any field you may need).
Category 1 | Field Types Fieldtype modules that represent a data type used by fields. |
---|---|
Category 2 | Input Fields Inputfield modules that provide a UI input widget in the ProcessWire admin. |
Category 3 | Language Modules Modules involved in providing multi-language support. |
Category 4 | Process Modules Process modules are apps that run in the ProcessWire admin. |
Release State | Stable Should be safe for use in production environments. * |
Author | |
Module Version | 1.0.6 |
Class Name | ImageExtra |
Compatibility | 3.0 |
Date Added | February 13, 2015 |
Last Updated | August 1, 2017 |
Recommended By | New recommendations may take up to 1 day to appear. |
Instructions
This module's files should be placed in /site/modules/ImageExtra/
How to install or uninstall modules
README
ProcessWire ImageExtra
Designed for use with ProcessWire 3.x
About
This module allows you to add additional informations to an image (for example: title, description, link, orientation and any field you may need).
Usage
For each instance of an image field the field settings will be extended. Navigate to Admin > Setup > Fields and edit the desired field. Click on the Input Tab and click on the "Image Extra Fields ..." area.It extends downwards and reveals a form to set up additional custom fields.
The following fields are available by default:
- description - image description (core)
- disable multi language description
- orientation - image orientation
- orientation values - values to use as class names or identifiers for different image orientations
- link - image link to internal pages
- other fields - here you can add any other field by writing it (separated by comma)
For each of the activated custom fields an own column in the specific table will be created.
As soon as you added any custom field(s), a table containing all fields appears below.
You can set here a textformatter (e.g. Markdown, Paragraph Stripper, ..) as well as a label text (multi-language) for each field - if you want to. The textformatters have to be installed before.
Caution: Just removing a custom field will not erase it, due to data persistence. If you really don't need it anymore you have to delete the column manually.
After having added some custom fields to an image field, edit a page which has a template containing this field.Below each image you get some additional config fields - and for sure it provides multi language support.
Accessing the values
This is no different than accessing the value of any other field.
$image = $page->image->getRandom();
echo $image->caption;
echo $image->location;
echo $pages->get($image->link)->url;
echo $image->getExtraLabel('location') . ': ' . $image->location;
Get extra field label
// outputs something like: "Location: Munich"
echo $image->getExtraLabel('location') . ': ' . $image->location;
// outputs something like: "Ort: München"
echo $image->getExtraLabel('location', 'de') . ': ' . $image->location;
Setting the values
From the API side you can set the values like this:
$page->setOutputFormatting(false);
$page->images->trackChange('title');
$image = $page->images->getRandom(); // or whatever image you want
$image->title = 'Title in default language';
$image->title($languages->get('fi'), 'Title in Finish');
$image->title($languages->get('de'), 'Title in German');
$page->save();
$page->setOutputFormatting(true);
Comments
Nice module!
Would be awesome to have such a functionality for InputfieldPage/Autocomplete too.
I'm not yet sure if I can manage this my own..we'll see ;-)Good work!
CheersNice nice nice! I've been using repeaters for this until now, which isn't very satisfying.
Post a Comment
Your e-mail is kept confidential and not included with your comment. Website is optional.
- Admin Helpers
- Authentication
- Core Modules
- Development Tools
- Email/WireMail
- Field Types
- Import/Export
- Input Fields
- Language Modules
- Language Packs
- Logs/Monitoring
- Markup Generation
- Photo/Video/Audio
- Premium Modules
- Process Modules
- Proof of Concept
- SEO/Accessibility
- Site Profiles
- Social, Feeds, Services
- Text Formatters
- Other Modules
- Users and Access
Disclaimer
*Use modules at your own risk. There are no guarantees or warranties. It is recommended that you backup your site and database before installing new modules.