forum.coppermine-gallery.net

Support => cpg1.5.x Support => cpg1.5 miscellaneous => Topic started by: dayjahone on September 05, 2010, 07:37:05 am

Title: File Information
Post by: dayjahone on September 05, 2010, 07:37:05 am
I have some custom file information fields, which is great, by the way, but there is some information that I don't want displayed in the image view (ie. Filename, Album name: Filesize, Dimensions, Displayed, and URL). I tried searching, but didn't come up with anything. I imagine this is simple, but I'm not having any luck. Please help. Thanks.
Title: Re: File Information
Post by: François Keller on September 05, 2010, 08:39:15 am
you must make the changes in your theme.php file. Search for the function who display the intermediate picture and midify as you want. If you don't find this function search in the theme.php file from the sample theme and copy paste the code in your theme.php file.

P.S. Post a link to your gallery....
Title: Re: File Information
Post by: dayjahone on September 05, 2010, 05:09:42 pm
I can't find it anything. I'm using the curve theme. http://weestyles.com/gallery
Title: Re: File Information
Post by: dayjahone on September 05, 2010, 05:35:48 pm
I looked through all 4400 lines of theme.php in the sample theme and still couldn't figure out where it was. Everything is well commented, so I must be a moron.  ???
Title: Re: File Information
Post by: Stramm on September 05, 2010, 05:47:21 pm
That's not a themeing issue. Here you just can specify the look of the picinfo but not the contents. One need to write a plugin to do that (hook: file_info) or modify core code.

Title: Re: File Information
Post by: François Keller on September 05, 2010, 05:50:54 pm
I looked through all 4400 lines of theme.php in the sample theme and still couldn't figure out where it was. Everything is well commented, so I must be a moron.  ???
No, my bad, i didn't look into the file and write my answer to fast, sorry, Stramm is right...
Title: Re: File Information
Post by: Stramm on September 05, 2010, 05:57:52 pm
here you go
Code: [Select]
<?php
/**********************************************
  Coppermine 1.5.x Plugin - Test
**********************************************/

if (!defined('IN_COPPERMINE')) die('Not in Coppermine...');

// Add filter for picinfo
$thisplugin->add_filter('file_info','fileinfo_change');

function 
fileinfo_change($data)
{
    global 
$CONFIG;
//print_r($data);
unset ($data['Filename']);
    return 
$data;
}
?>
you'll need to write a config file for it... or just copy one from another pluginb and modify the contents.

uncomment the print_r() function to see all entries at the top of displayimage.php. See what you want tto have removed and do it similar to what you see I've done for the 'Filename'. The unset() function 'removes' the data.
Title: Re: File Information
Post by: dayjahone on September 05, 2010, 06:10:49 pm
Wow, now I'm completely lost. I thought I could just delete a few lines. I need to write a plugin?!?!? No idea how to do that.
Title: Re: File Information
Post by: dayjahone on September 05, 2010, 06:13:21 pm
I find no "print_r" in displayimage.php
Title: Re: File Information
Post by: Stramm on September 05, 2010, 06:19:47 pm
the code above is the entire plugin. Here you see the print_r() function. Remove the two slashes at the beginning and it'll start working when you open an image (displayimage.php). It's just meant to find out the array names. So if you know everything you want to remove comment it out again.

I'm uploading the entire plugin for you. It's just named test with no fancies but it's working.
Title: Re: File Information
Post by: dayjahone on September 05, 2010, 06:53:18 pm
OK, almost there! Thank you so much for holding my hand through this! The only two I can't get rid of are "Filesize" and "Rating."
Title: Re: File Information
Post by: dayjahone on September 05, 2010, 07:05:23 pm
This is what I have now:

function fileinfo_change($data)
{
    global $CONFIG;
   //print_r($data);
   unset ($data['Filename']);
   unset ($data['Album name']);
   unset ($data['Keywords']);
   unset ($data['filesize']);
   unset ($data['Dimensions']);
   unset ($data['Displayed']);
   unset ($data['URL']);
   unset ($data['Rating']);   
    return $data;
}
Title: Re: File Information
Post by: Stramm on September 05, 2010, 07:16:37 pm
write filesize with an initial capital letter

to remove the rating is more difficult. If you do not want to display it then it's the easiest way to disable it (group control panel)
Title: Re: File Information
Post by: Stramm on September 05, 2010, 07:19:44 pm
or use
Code: [Select]
unset ($data);if you want to remove everything

be aware that the per entry solution just removes the entries for your language. If a user uses eg. spanish, then you'll have to remove the spanish entreis, too. Switch to spanish to see that.
Title: Re: File Information
Post by: dayjahone on September 05, 2010, 07:23:52 pm
Brilliant!!! Thank you so much!
Title: Re: File Information
Post by: Αndré on September 06, 2010, 03:24:08 pm
be aware that the per entry solution just removes the entries for your language. If a user uses eg. spanish, then you'll have to remove the spanish entreis, too. Switch to spanish to see that.
In this case I'd use the following approach:
Code: [Select]
global $lang_common;
unset($data[$lang_common['filename']]);
unset($data[$lang_common['filesize']]);