I would like to upload some audio files (mp3) have these display in the item record, preferably with icons identifying them as audio files.
I saw some postings related to this subject from approximately one year ago (http://omeka.org/forums/topic/icons-for-sound-files) and a reference to a change in the next version of Omeka (https://omeka.org/trac/changeset/3547). However, I still am not clear as to how this works. Do I need to modify the media.php file as indicated by the documentation on this ticket or has this been done already? What other changes are required?
I am using Omeka v.1.1
Here is a link to my test record: http://188.8.131.52/omeka/items/show/6322
Thank you for your help.
Give this a shot:
You can modify something like this for your items/show page. Add the image icons in the theme's image directory and you can define the mime type you want to show an icon.
echo display_files_for_item(array('showFilename'=>false, 'linkToFile'=>true, 'linkAttributes'=>array('rel'=>'lightbox'), 'filenameAttributes'=>array('class'=>'error'), 'imgAttributes'=>array('id'=>'foobar'), 'icons' => array('audio/mpeg'=>img('audio.gif'))))
There is also a related post on the dev list: http://groups.google.com/group/omeka-dev/browse_thread/thread/173817532de33aa8/c83ca90d9c196263?lnk=gst&q=icon#c83ca90d9c196263
Thanks for this code. I have added it to the show.php file. I also have added some gifs to my images folder. But, obviously, I am still missing something here.
Currently, I get a list of files on my item screen (my items all have multiple audio files associated with them) that looks like this:
alt : OH1CD2Track 01.mp3
alt : OH1CD1Track 02.mp3
The same list of files appears at the top of the screen where the full size image usually displays. How can I allow an image to display, but not have other types of files display?
Also, I was expecting my icons to appear with the file links, but that is not the case.
Here is a link to a sample item: http://184.108.40.206/omeka/items/show/6322
I don't have much php experience, but I guess that is obvious!
Can you please post the code you embedded in your items/show.php? (use backtick characters to surround your code example)
Here is the piece of code:
<?php echo display_files_for_item(array('showFilename'=>false, 'linkToFile'=>true, 'linkAttributes'=>array('rel'=>'lightbox[group]'), 'filenameAttributes'=>array('class'=>'error'), 'imgAttributes'=>array('id'=>'foobar'),'icons' => array(
Any further thoughts on this?
Try removing all the other parameters except the 'icons' one, like this:
'icons' => array(
'audio/midi' => img('disk_multiple.gif')
Inside the array for 'icons', be sure to list other MIME types as needed. The icons will need to be in your current public theme, too.
I just tried this with a MIDI file on Omeka version 1.1, and it gave me a list of files, with the icons next to a link to individual files.
If this does work, then there seems to be an issue with the combination of parameters used in Sheila's example.
Hope this helps!
After playing with Sheila's example a bit, it seems to work fine, except that 'showFileName' should be set to true if you want the file name to appear with the icon. I suspect its not working because you either haven't accounted for all the MIME types for the files you're listing, or you don't have the correct file name passed to the img() helper for the icon.
I have put the files for the icons into the \images directory under my theme. Is that the correct location for them? If so, I don't think the problem is with the file names passed to img().
I think that I have accounted for the MIME types for the files that I am trying to display. Actually, right now, I am only working with some mp3 files. But, I wonder if I am not referencing these correctly?
I have input "audio/mpeg" into the format field for the item and file records. Is that correct?
I am using Omeka v.1.1
Here is a link to my test record: http://220.127.116.11/omeka/dental plan/show/6322
Thank you for your help.
I'm thinking of switching my website over from wordpress to Omeka, but I'm wondering if there is an interface that lets you edit these .php files as needed, like the wordpress editor. Does that exist?
I know this is a very old thread, and everything changed massively since 1.1 to 2.1, but I would like to do something similar as OP.
I want to add several different icons to a file. The only difference is that I'm using item_image_gallery() to show my files in items/show.php because this is linking to the show.php in /files, whereas display_files_for_item() links directly to the file.
So, do I need to write a new function here, of can I set icons for different MIME types globally somewhere now?
Sorry, I found the answer right after posting:
Instead of 'linkToFile'=>true use 'linkToMetadata'=>true.
This works fine:
<?php echo files_for_item(array('showFilename' => false,
'linkToMetadata' => true,
'linkAttributes' => array('rel'=>'lightbox'),
'icons' => array('application/pdf'=>img('pdf-icon.png'),