With images API you can generate the image and the image gallery for an item and also the upload forms for both of them.
Left: Default image with the "edit" button. Right: Image with "edit" button.
Up: Default image gallery with no images and the "add images" button. Down: Default image gallery with images and the "add images" button.
API example
Item image
jimport('oniscore.image'); //import images libraries
$imageHTML = onisImage::imageHTML($petition, 'petition', CCOMPONENT);
Generate the HTML code:
onisImage::imageHTML($itemData, $item, $component);
- $itemData - item data;
- $item - unique item name;
- $component - component name;
You can change HTML code here:
components/component_name/templates/default/images.item.php
Item image gallery
jimport('oniscore.image'); //import images libraries
$galleryHTML = onisImage::galleryHTML($petition, 'petition', CCOMPONENT);
Generate the HTML code:
onisImage::galleryHTML($itemData, $item, $component);
- $itemData - item data;
- $item - unique item name;
- $component - component name;
You can change HTML code here:
components/component_name/templates/default/images.gallery.php
Preferences
From the component preferences you can change a few options about the image and image gallery:
- image folder - folder where item image will be uploaded;
- max image size - maximum file size of the image an user can upload for the item, not bigger than the upload_max_filesize defined in your php.ini;
- gallery images folder - folder where gallery images will be uploaded;
- gallery image size - maximum file size of each image an user can upload in the gallery, not bigger than the upload_max_filesize defined in your php.ini;
- gallery images limit - maximum number of images an user can upload, 0 for unlimited;