1

Topic: Adding an image to a taxon in the Warehouse

Hi
I'm experimenting with adding an image for a red squirrel and grey squirrel to my species list for the squirrel recording site. John showed me how to do this at the advanced training but when I have browsed for the image, added the caption and clicked save I get an error page (URL: http://warehouse1.indicia.org.uk/index. … mage/save) telling me:

Unable to Complete Request
You can go the home page or try again

Trying again doesn't work.

Is there a bug in this facility or is there a permissions issue here?

Thanks,
Fiona

Fiona McCrory
CEDaR Website Officer
www.nmni.com/cedar

2

Re: Adding an image to a taxon in the Warehouse

Hi Fiona

That is what you see when there is an unhandled exception - a bug in other words.

I tried it on the testwarehouse and experienced the same. The log contains the following:

error: #2: Error converted to exception. Missing argument 4 for Image::create_image_files(), called in D:\web sites\indicia\content\client_helpers\submission_builder.php on line 228 and defined at line 39 in file D:\web sites\indicia\content\application\libraries\MY_Image.php

--- debug: Stack trace:
    D:\web sites\indicia\content\application\libraries\MY_Image.php - line 39 - indicia_error_handler
    D:\web sites\indicia\content\client_helpers\submission_builder.php - line 228 - create_image_files
    D:\web sites\indicia\content\client_helpers\submission_builder.php - line 97 - wrap_with_images
    D:\web sites\indicia\content\application\libraries\MY_ORM.php - line 1393 - build_submission
    D:\web sites\indicia\content\application\libraries\MY_ORM.php - line 1378 - wrap
    D:\web sites\indicia\content\application\controllers\indicia.php - line 314 - set_submission_data
    Unknown file - line Unknown - save
    D:\web sites\indicia\content\system\core\Kohana.php - line 291 - invokeArgs
    Unknown file - line Unknown - instance
    D:\web sites\indicia\content\system\core\Event.php - line 209 - call_user_func
    D:\web sites\indicia\content\system\core\Bootstrap.php - line 55 - run
    D:\web sites\indicia\content\index.php - line 112 - require

Jim Bacon.

3

Re: Adding an image to a taxon in the Warehouse

Hi

Just for the record, I tried this on my local setup and went through Lookup Lists>Species Lists>(edit one of them)>Taxa Tab>(edit a taxon)>Images Tab>New Taxon Image

which sounds like the same route you're taking. For what it's worth this worked okay for me (although I now have a picture of a short-eared owl in the Azure Damselfly taxon. Ah well, I'm just learning...

Indicia version is 0.8.1

Not sure if any of that is any help really

Ta

Iain

4

Re: Adding an image to a taxon in the Warehouse

Thanks, Iain, that was exactly what I was doing. Could be helpful as it points to a fault introduced between the tagged release, 0.8.1, and the 0.8.2 branch we are running which is 0.8.1 "plus bug fixes".

Fiona, while I confirmed there was a problem, I don't want to leave you with the impression that I am about to fix it as I have other priorities. You could add it to the issue list to stop it being forgotten about.

Jim Bacon.

5

Re: Adding an image to a taxon in the Warehouse

Hi Fiona,
Thanks for reporting this - I've now fixed it on the test and live warehouses.
Best wishes
John

John van Breda
Biodiverse IT

6

Re: Adding an image to a taxon in the Warehouse

Thanks everyone.

I've now uploaded 2 squirrel images to the test warehouse and have a record submission form using that species list. I now haven't the faintest idea how to get the image to appear on the form i.e. as a visual guidance since there are only two species to choose from. I've search though the docs but can't find mention of it. Are there instructions for this somewhere? If not, don't worry. It's not a priority.

Thanks,
Fiona

Fiona McCrory
CEDaR Website Officer
www.nmni.com/cedar

7

Re: Adding an image to a taxon in the Warehouse

Hi Fiona,

I thought you were going to tell me how to do it because I haven't ever seen this used!

If I wanted the taxon image beside the taxon name in the species grid I would be looking at the following kind of things:
1. modifying the $indicia_templates['taxon_label] as mentioned in the API documentation for the species_checklist function.
2. modifying the data returned by the call to get_population_data in get_species_checklist_taxa_list so that it includes a path to the taxon image. I would probably look at modifying the database view, list_taxa_taxon_lists to do this.

I don't really expect that to mean anything to you but it is just a record of my thoughts having given a brief look to see if I could see a way of doing something.

So what that is saying is that it is certainly possible with a little bit of programming but I am unaware of any existing mechanism for simply turning on this feature.

Jim Bacon.

8 (edited by iain 14-04-2014 17:52:22)

Re: Adding an image to a taxon in the Warehouse

Well after much fiddling about I have managed to get something working... Thought I'd dump the processes I went through here for others to consider.

1: create a species list with the appropriate images in indicia (my example below uses a wee bird list)
2: grab the taxon images by using get_population_data and load_existing_record (and check http://forums.nbn.org.uk/viewtopic.php?id=4473 for access to the image table)
3: parcel it up into a table with javascript to detect the hover and click events

and that's pretty much it. There is a bit of coding involved but I've done this in ASP.Net so it's not a module that's easily 'plugged in' to indicia. And an image of it in action below...

[img=PicList bbcode test]http://www.ereca.org.uk/Images/piclist.jpg[/img]

Hope it's of some help

Ta
Iain

9

Re: Adding an image to a taxon in the Warehouse

Hi...  I need to show the image related a taxon in forms but i don't know how to show it. I tried to set these:

Form Category > "MNHNL forms"
Form > "MNHNL Dynamic 1 - dynamically generated data entry form"
Single Species Selection Control Type > "Tree browser"

but i see a box with the taxon names but no images even if i set the image in the warehouse in taxon list... how can i solve? i have warehouse v0.81 but in next days i want to move to 0.90. Thanks

Carlo Politi - Software Engineer
QuestIT s.r.l.
Home page: www.quest-it.com
E-Mail: politi@quest-it.com - Skype: carlo.politi.questit

10

Re: Adding an image to a taxon in the Warehouse

Hi Carlo

As far as I know, there is no species selection control that shows the taxon image.
The discussion above gives hints about how to modify the code to do this but it needs the skills of a programmer.

Jim Bacon.

11

Re: Adding an image to a taxon in the Warehouse

Hi Jim, thanks for the info... i thought it was possible to use the "Tree browser"...

Carlo Politi - Software Engineer
QuestIT s.r.l.
Home page: www.quest-it.com
E-Mail: politi@quest-it.com - Skype: carlo.politi.questit

12

Re: Adding an image to a taxon in the Warehouse

Maybe... why did you think that?

Take a look at the tree browser function.
http://www.biodiverseit.co.uk/indicia/d … ee_browser

If you set the table to 'taxa_taxon_lists' and the view to 'detail', image_path and image_caption will be returned from the database query.

I think you would just need to override the template for tree_browser_node to include something like
<img src="{image_path}" alt="{img_caption} title={img_caption} />

Jim Bacon.

13

Re: Adding an image to a taxon in the Warehouse

ok thanks, i will try...

Carlo Politi - Software Engineer
QuestIT s.r.l.
Home page: www.quest-it.com
E-Mail: politi@quest-it.com - Skype: carlo.politi.questit

14

Re: Adding an image to a taxon in the Warehouse

Jim Bacon wrote:

If you set the table to 'taxa_taxon_lists' and the view to 'detail', image_path and image_caption will be returned from the database query.

Hi Jim, sorry to bother again: when you say to set the table and the view, where can i find these infos? Thanjs

Carlo Politi - Software Engineer
QuestIT s.r.l.
Home page: www.quest-it.com
E-Mail: politi@quest-it.com - Skype: carlo.politi.questit

15

Re: Adding an image to a taxon in the Warehouse

Hi Carlo,

I discovered something I didn't know, just by luck.
In the prebuilt form, dynamic_sample_occurrence, which is a parent of MNHNL Dynamic 1, in the function get_control_species_single there is the following code:

    if ($ctrl=='tree_browser') {
      // change the node template to include images
      $indicia_templates['tree_browser_node']='<div>'.
          '<img src="'.data_entry_helper::$base_url.'/upload/thumb-{image_path}" alt="Image of {caption}" width="80" /></div>'.
          '<span>{caption}</span>';
    }

It looks like you were correct and the tree browser already does what you need.
Obviously you need to have saved images for the taxa in your species list first, before anything will appear.

You may need to add an option in the Form Structure when setting up the form in Drupal, under the [species] control, like @list=detail since the tree browser defaults to the list view rather than the detail view. Only the detail view contains the information about the taxon images.

All of the above is for version 0.9.0 which I am using. You would need to check the code and the database views to be sure this applies to version 0.8.0.

Jim Bacon.

16

Re: Adding an image to a taxon in the Warehouse

Thanks for the good news! Is it risky to update to 0.90 indicia & warehouse? just copy the folders over the iform and feature_indicia and over warehouse?

Carlo Politi - Software Engineer
QuestIT s.r.l.
Home page: www.quest-it.com
E-Mail: politi@quest-it.com - Skype: carlo.politi.questit

17

Re: Adding an image to a taxon in the Warehouse

Hi Carlo,

I am not aware of any unusual risks with upgrading. Follow the step-by-step instructions.
You may not need to upgrade to use this feature - I don't have a version 0.8.0 installation that I can look at.
I would advise upgrading  to get new features and on-going support.

Jim Bacon

18

Re: Adding an image to a taxon in the Warehouse

ok... the problem is i don't know where put "@list=detail" in Species...

Carlo Politi - Software Engineer
QuestIT s.r.l.
Home page: www.quest-it.com
E-Mail: politi@quest-it.com - Skype: carlo.politi.questit

19

Re: Adding an image to a taxon in the Warehouse

Hi Carlo

You would put "@list=detail" in the Form Structure when setting up the form in Drupal, under the [species] control.

Since neither the tree browser nor the treeview work without the details view being specified (as it contains the parent term needed to build a tree hierarchy) I have committed a change (r7446) which will cause this view to be used by default in future.

Jim Bacon.

20

Re: Adding an image to a taxon in the Warehouse

Thanks Jim, i will try as soon as i can..

Carlo Politi - Software Engineer
QuestIT s.r.l.
Home page: www.quest-it.com
E-Mail: politi@quest-it.com - Skype: carlo.politi.questit

21

Re: Adding an image to a taxon in the Warehouse

Hello, i'm still here to try to show images... I have these settings in my "Form structure", and "Tree Browser" is selected. But i don't see any image, only the name... I put in attachment the screenshot of what i see when i save settings in drupal and the screenshot of what i have put in a record of my spieces list.
I'm using v0.82 in Drupal and Warehouse. I fear to update to v0.90 but if someone tell me how is wth 0.90 i can solve, i try but i don't want to mess up the working installation.. Thanks


=Species=
?QUALE PIANTA DELLA DUNA HAI VISTO??
[species]
@label=Specie
@resizeWidth=1500
@resizeHeight=1500
@list=detail
[species attributes]
[*]
=Place=
?INSERISCI LE COORDINATE DELL'OSSERVAZIONE (SE NOTE) O INDICA IL PUNTO ESATTO SULLA MAPPA.    IN ALTERNATIVA, PUOI EFFETTUARE UNA RICERCA PER LOCALITÀ.?
[place search]
@label=Ricerca la località
[spatial reference]
@label=Coordinate geografiche
[map]
@label=Mappa
[*]
=Other Information=
?INSERISCI LA DATA DELL'OSSERVAZIONE?
[date]
@label=Data
?INSERISCI EVENTUALI NOTE E ALTRE INFORMAZIONI DI DETTAGLIO?
[sample comment]
@label=Note
[*]
=*=
Post's attachments

screenshots.jpg 94.88 kb, file has never been downloaded. 

You don't have the permssions to download the attachments of this post.
Carlo Politi - Software Engineer
QuestIT s.r.l.
Home page: www.quest-it.com
E-Mail: politi@quest-it.com - Skype: carlo.politi.questit