Hi Eric
currently it's not possible to use multiple upload fields per item, but you can still use multiple images per field. However, you can change that by editing the upload field module, if you are comfortable with PHP language.
Let me show you a few examples based on the Fruits category above:
http://get-simple.info/forums/showthread...7#pid51357
Let's say one of your items named 'Cherries' looks like this:
![[Image: imanager.2014_cherries01.jpg?dl=0]](https://dl.dropbox.com/s/0v06alpm8054cz0/imanager.2014_cherries01.jpg?dl=0)
To show your items in your Theme, try the following:
If you do print_r($itemClass->items); then you will see a long list with your Item-objects. Scroll down to [image] => Field Object. Here you can see all papameter you can use to build your output, for example:
Shall we say, we wish to get only item named 'Cherries':
To get all parameter of your image field, you can do following: [objectname]->[fields]->[your_field_name]:
So let us make it a bit shorter:
If you simple want to get a default thumbnail (created automaticly by ItemManager during the upload) you can do:
If you want to create your own thumbnails any size you want. So you can use 'phpthumb' class (already included in IM 2.0, but currenty not yet implemented in core)
The library allows you to show an image after manipulation or save it to the filesystem. More info: https://github.com/masterexploder/PHPThu...asic-Usage
Sample, resize image and save it:
Markup:
Hope this helps
(2015-08-16, 20:51:10)Erick67 Wrote: 1- Is it possible to have several image fields per record ?
( still the error msg : The image upload field can only be used once per item. )
currently it's not possible to use multiple upload fields per item, but you can still use multiple images per field. However, you can change that by editing the upload field module, if you are comfortable with PHP language.
(2015-08-16, 20:51:10)Erick67 Wrote: 2- I see IM is generating Thumbnails then could you let me know the code in order to have the Thumbnail on GS page and have the large image in a box onclick
Let me show you a few examples based on the Fruits category above:
http://get-simple.info/forums/showthread...7#pid51357
Let's say one of your items named 'Cherries' looks like this:
![[Image: imanager.2014_cherries01.jpg?dl=0]](https://dl.dropbox.com/s/0v06alpm8054cz0/imanager.2014_cherries01.jpg?dl=0)
To show your items in your Theme, try the following:
PHP Code:
// get IM instance
$manager = new IManager();
// get Category & Item class instances
$categoryClass = $manager->getCategoryClass();
$itemClass = $manager->getItemClass();
// to get an instance of the fruits category, by category name for example:
$fruits_cat = $categoryClass->getCategory('name=Fruits');
// initialize all items of the Fruits-category by fruits category id
$itemClass->init($fruits_cat->get('id'));
// here are all your items of category fruits
echo '<pre>';
print_r($itemClass->items);
echo '</pre>';
If you do print_r($itemClass->items); then you will see a long list with your Item-objects. Scroll down to [image] => Field Object. Here you can see all papameter you can use to build your output, for example:
Code:
[image] => Field Object
(
[categoryid:protected] => 6
[file:protected] => /Applications/MAMP/htdocs/imanager.2014/data/imanager/fields/6.im.fields.xml
[filename:protected] => 6.im.fields.xml
[id:protected] => 2
[confirmed:protected] => 0
[name] => image
[label] => Images
[type] => imageupload
[position] => 2
[default] =>
[options] => Array
(
)
[info] =>
[required] =>
[minimum] =>
[maximum] =>
[areaclass] =>
[labelclass] =>
[fieldclass] =>
[configs] => stdClass Object
(
)
[created] => 1432209888
[updated] =>
[areacss] =>
[labelcss] =>
[fieldcss] =>
[value] => /Applications/MAMP/htdocs/imanager.2014/data/uploads/imanager/3.6/
[imagename] => Array
(
[0] => sharry.jpg
[1] => lex_kirschen.jpg
)
[imagepath] => Array
(
[0] => /Applications/MAMP/htdocs/imanager.2014/data/uploads/imanager/3.6/
[1] => /Applications/MAMP/htdocs/imanager.2014/data/uploads/imanager/3.6/
)
[imagefullpath] => Array
(
[0] => /Applications/MAMP/htdocs/imanager.2014/data/uploads/imanager/3.6/sharry.jpg
[1] => /Applications/MAMP/htdocs/imanager.2014/data/uploads/imanager/3.6/lex_kirschen.jpg
)
[imageurl] => Array
(
[0] => http://imanager.2014/data/uploads/imanager/3.6/
[1] => http://imanager.2014/data/uploads/imanager/3.6/
)
[imagefullurl] => Array
(
[0] => http://imanager.2014/data/uploads/imanager/3.6/sharry.jpg
[1] => http://imanager.2014/data/uploads/imanager/3.6/lex_kirschen.jpg
)
)
)
Shall we say, we wish to get only item named 'Cherries':
PHP Code:
$sherry = $itemClass->getItem('name=Cherries');
To get all parameter of your image field, you can do following: [objectname]->[fields]->[your_field_name]:
PHP Code:
echo '<pre>';
print_r($sherry->fields->image);
echo '</pre>';
So let us make it a bit shorter:
PHP Code:
$image = $sherry->fields->image;
If you simple want to get a default thumbnail (created automaticly by ItemManager during the upload) you can do:
PHP Code:
echo '<pre>';
print_r($image->imageurl[0].'thumbnail/'.$image->imagename[0]);
echo '</pre>';
If you want to create your own thumbnails any size you want. So you can use 'phpthumb' class (already included in IM 2.0, but currenty not yet implemented in core)
PHP Code:
require_once(GSPLUGINPATH.'imanager/phpthumb/ThumbLib.inc.php');
The library allows you to show an image after manipulation or save it to the filesystem. More info: https://github.com/masterexploder/PHPThu...asic-Usage
Sample, resize image and save it:
PHP Code:
$thumb = PhpThumbFactory::create($image->imagefullurl[0]);
$thumb->resize(150);
$thumb->save($image->imagepath[0].'thumbnail/150_'.$image->imagename[0], 'jpg');
echo '<pre>';
print_r($image->imageurl[0].'thumbnail/150_'.$image->imagename[0]);
echo '</pre>';
Markup:
PHP Code:
echo '<img alt="" src="'.$image->imageurl[0].'thumbnail/150_'.$image->imagename[0].'">';
Hope this helps