forum.coppermine-gallery.net
Support => cpg1.5.x Support => cpg1.5 miscellaneous => Topic started by: localhistory on April 01, 2010, 10:47:28 am
-
Hi -
I'd like to use coppermine to catalog and display images from an historical association. We use Dublin Core metadata to describe our images, which means we need 15 user defineable description fields. I know there are some threads on modifying 1.4.3 for more than 4 user defineable description fields, but I don't know if these methods will work in 1.5.3.
Thanks!
-
Please post those tutorials how to modify cpg1.4.x and we will see if that mod(s) can be applied to cpg1.5.x.
-
The second to last post in thread lists a solution for 1.4.x
http://forum.coppermine-gallery.net/index.php/topic,7803.0.html
Thanks!
-
That is a mod for 1.3.x ;)
this one is for 1.4.x => http://forum.coppermine-gallery.net/index.php/topic,23695.0.html
I don't know if it will work for 1.5.x though
-
Looks like this mod can be ported to cpg1.5.x. But you have to consider http://documentation.coppermine-gallery.net/en/dev_superglobals.htm
Maybe we can change the Coppermine code in a way, that the modification effort can be reduced or even be dropped and the mod can be converted to a plugin. I'll have a look at it after the Easter weekend.
-
There is a way to circumvent the extra security that Inspekt adds - take a look at the Joomla bridge:
Concerning the code used in my bridge, I guess I'm not respecting the "spirit" of the "Inspekt package" . I got to access directly to stored superglobals with "_source" property (especially $COOKIE) before calling Joomla .
I'm not fond though of that "lazy" way of programming.
The entire approach of that mod that requires an awfull lot of modifications is something that I'm not very fond of, so let's review the entire idea:I'd like to use coppermine to catalog and display images from an historical association. We use Dublin Core metadata to describe our images, which means we need 15 user defineable description fields. I know there are some threads on modifying 1.4.3 for more than 4 user defineable description fields, but I don't know if these methods will work in 1.5.3.
Why not use IPTC instead? The data can then be stored as meta data inside the image, so you don't lose anything if you should decide to use another app. The drawback is that coppermine can only read IPTC data, but it can not write it back, so the additional information would reside in Coppermine's database.
-
RE: IPTC
There are a few issues there.
We're looking for a way for small (read underfunded with volunteers with zero to minimal computer skills) local historical groups to be able to catalog and digitize their collections and make them accessible to the public and the worldwide scholarly community. Coppermine would be ideal for this because it's free, photo and data entry is easy, and it will run on really cheap shared hosting.
Using IPTC would mean adding a layer of complexity and expense. The data would have to be attached to each image with a program capable of doing so, and volunteers would have to learn an additional procedure. The fewer steps for the volunteers and the less they have to learn, the better.
The biggest issue is probably that IPTC is a standard for press images and the metadata fields reflect this. We're going to be cataloging documents and objects in addition to photos. I realize we could fudge things a little, but this would mean getting volunteers to understand that IPTC metadata field "X" is really Dublin Core metadata field "Y." Trust me, this is a recipe for data entry disaster.
My bet is that if additional metadata fields could be easily added to coppermine you would get quite a following in the museum and library communities. The one decent web gallery product that allows for Dublin Core is ridiculously expensive and charges rip-off hosting and maintenance rates.
-
there is a full tutorial on thishttp://www.bloggersplace.com/tutorials/ (http://www.bloggersplace.com/tutorials/) site with pictures and download files .. . i think if you have a clean install of coppermine 1.5.3 you can just replace the files with the download files .. make sure to backup your files your replacing though . I took the Liberty to attach the files here aswell ,,
-
Thanks for your time to come up with those instructions and your readiness to share them. I have changed your profile status accordingly. However, there are some things I'd like to remark first regarding your tutorial:
- It's not a bright idea to use the zip archive attached if you're running anything else than cpg1.5.3 RC
- There is no guarantee that I haven't made a mistake performing the copy and paste, nor is there any gauarntee that the code changes posted will work in the first place
- I'm still convinced that nobody needs so many extra fields
Please allow me as well to post my thoughts on your tutorial itself
- The colors you use are a no-no
- URLs with file names with spaces in it (like custom fields to coppermine.php) are a very bad idea, and they lead to URLs like http://www.bloggersplace.com/tutorials/addinfieldstocoppermine1.5.x/custom%20fields%20to%20coppermine.php that simply don't look nice
- Capitalization: in English sentences start with an uppercase word. It increases readability a lot
- Ortography: using a basic spell checker (decent browsers come with spell checkers) can correct the worst mistakes, which increases the readability and (most importantly) the credibility of your postings
- Some of your instructions (like the database manipulation section) are incomplete or inaccurate
- Indentation of code increases readability enourmously
- Your usage of punctuation marks is... exotic (like the ,,,,, lines). Doesn't look nice nor interessting nor does it give you an individual note. It just looks...bad
- I'm pretty sure that you assume too much: posting detailed instructions means posting detailed instructions: in several spaces you just write "etc. etc." - the needed steps might be obvious to you, but not to the newbies who try to replicate this complicated hack.
- Wannabe-jokes with the confusion of the words "ass" and "add" are not funny.
Anyway: instructions start here:
Tutorial on how to add more custom fields to your picture in coppermin 1.5.x
(lets all just take some time and love opensource)
If you use the download files then be sure those files you overrighting have not been modified ,, the files in the add on is edited from the file you would have if you had a clean install of coppermine 1.5.x
here are my files you can download if you want to compare or replace with your clean instalation of coppermine
please be sure to Backup any file you replace
You can find the latest updates to coppermine 1.5.x at sourceforge.net (http://sourceforge.net/projects/coppermine/files/)
here is a screenshot of the outcome :
-
Adding custom fields to coppermine 1.5.x
step 1
changing your SQL database and adapting it to changes :
open your sql database manager tool (im using phpmyadmin) and access your database then the table called 'cpg15x_config'(this is the default name)
Screenshot step01.1.jpg
next we will add new rows to this table , the pictures have 4 fields at the moment and we want to add more so we will have to add to the table ; user_field5_name ; user_field6_name etc. you can add as many as you need i added 8 but to keep the tutorial little more simple i will only add 4 here you can use your own logic to add more ;-)
so now just click the insert tab and add the fields "user_field5_name" etc...
FYI these rows hold the data you want your picture fields when uploading to be named ...........
Screenshot step01.2.jpg
so when that is done we will move to changing the _pictures table
now go to the cpg15x_pictures and look at the structure
there are fields called user1 , user2 , etc.
FYI. this is where coppermine will save the data the user types in to the custom picture fields
Screenshot step01.3.jpg
if we look at the structure of the field it has user(x) as varchar(255) with collation latin1_swedish_ci(this may vary and its important that you add tables in the same collation as the ones already in the database)and is not null, so now we will make 4 more fields adding to the user 4 and so on .
now lets add the fields we need. Right at the bottom of the sturcture window there is a add fields field , so now
add 4 fields > at end of table > hit "go"
now fill the new details for the new fields as shown below
Screenshot step01.4.jpg
then hit "save"
... now you will be happy to know that step1 is over and we are done editing the database ....go have a smoke/coffie
-
Step2.Editing/modifing the db_input.php file
lets open the db_input.php file .
look for the code : if (!USER_CAN_UPLOAD_PICTURES) {
if ($CONFIG['log_mode'] != 0) {
log_write('Denied privileged access to db_input.php (upload picture) for user '.$USER_DATA['user_name'].' at ' . $hdr_ip, CPG_SECURITY_LOG);
}
cpg_die(ERROR, $lang_errors['perm_denied'], __FILE__, __LINE__);
}
$album = $superCage->post->getInt('album');
$title = $superCage->post->getEscaped('title');
$caption = $superCage->post->getEscaped('caption');
$keywords = $superCage->post->getEscaped('keywords');
$user1 = $superCage->post->getEscaped('user1');
$user2 = $superCage->post->getEscaped('user2');
$user3 = $superCage->post->getEscaped('user3');
$user4 = $superCage->post->getEscaped('user4');
then add at the bottom of that $user5 = $superCage->post->getEscaped('user5');
$user6 = $superCage->post->getEscaped('user6');
$user7 = $superCage->post->getEscaped('user7');
$user8 = $superCage->post->getEscaped('user8');
when that is done
now look for the code :// Upload is ok
// Create thumbnail and internediate image and add the image into the DB
$result = add_picture($album, $filepath, $picture_name, 0, $title, $caption, $keywords, $user1, $user2, $user3, $user4, $category, $raw_ip, $hdr_ip, $superCage->post->getInt('width'), $superCage->post->getInt('height'));
then after $user4, add user5 and so forth
here is how it should look// Upload is ok
// Create thumbnail and internediate image and add the image into the DB
$result = add_picture($album, $filepath, $picture_name, 0, $title, $caption, $keywords, $user1, $user2, $user3, $user4, $user5, $user6, $user7, $user8, $category, $raw_ip, $hdr_ip, $superCage->post->getInt('width'), $superCage->post->getInt('height'));
save the file !!
okay awesome stuff now the file feeding the database is edited ..
-
Step3.Editing/modifing the displayimage.php file
open file and look for this code , its around line 200for ($i = 1; $i <= 4; $i++) {
then change the 4 to the amount of fields you need (when adding 4 the code should befor ($i = 1; $i <= 8; $i++) {
this code you should finde around line 200 in the cade
Save your file
-
Step4.Editing/modifing the editpics.php file
open file and look for this code $THUMB_ROWSPAN = 5;
then change the 5 to the amount of fields you need +1 for spacing (when adding 4 the code should be :$THUMB_ROWSPAN = 9;
this code you should find around line 108
now just below that is this code if ($CONFIG['user_field1_name'] != '') {
$THUMB_ROWSPAN++;
}
if ($CONFIG['user_field2_name'] != '') {
$THUMB_ROWSPAN++;
}
if ($CONFIG['user_field3_name'] != '') {
$THUMB_ROWSPAN++;
}
if ($CONFIG['user_field4_name'] != '') {
$THUMB_ROWSPAN++;
}
add onto this codeif ($CONFIG['user_field5_name'] != '') {
$THUMB_ROWSPAN++;
}
etc....
so at the end the code should look like this :if ($CONFIG['user_field1_name'] != '') {
$THUMB_ROWSPAN++;
}
if ($CONFIG['user_field2_name'] != '') {
$THUMB_ROWSPAN++;
}
if ($CONFIG['user_field3_name'] != '') {
$THUMB_ROWSPAN++;
}
if ($CONFIG['user_field4_name'] != '') {
$THUMB_ROWSPAN++;
}
if ($CONFIG['user_field5_name'] != '') {
$THUMB_ROWSPAN++;
}
if ($CONFIG['user_field6_name'] != '') {
$THUMB_ROWSPAN++;
}
if ($CONFIG['user_field7_name'] != '') {
$THUMB_ROWSPAN++;
}
if ($CONFIG['user_field8_name'] != '') {
$THUMB_ROWSPAN++;
}
next we find this code
the next code should be located around line 149$data = array(
array($icon_array['file_info'] . $lang_editpics_php['pic_info'], '', 3),
array($icon_array['album'] . $lang_common['album'], 'aid', 1),
array($icon_array['title'] . $lang_common['title'], 'title', 0, 255),
array($icon_array['description'] . $captionLabel, 'caption', 2, $CONFIG['max_img_desc_length']),
array($icon_array['keyword'] . $keywordLabel, 'keywords', 0, 255),
array($CONFIG['user_field1_name'], 'user1', 0, 255),
array($CONFIG['user_field2_name'], 'user2', 0, 255),
array($CONFIG['user_field3_name'], 'user3', 0, 255),
array($CONFIG['user_field4_name'], 'user4', 0, 255),
);
then we add to it so it looks like this$data = array(
array($icon_array['file_info'] . $lang_editpics_php['pic_info'], '', 3),
array($icon_array['album'] . $lang_common['album'], 'aid', 1),
array($icon_array['title'] . $lang_common['title'], 'title', 0, 255),
array($icon_array['description'] . $captionLabel, 'caption', 2, $CONFIG['max_img_desc_length']),
array($icon_array['keyword'] . $keywordLabel, 'keywords', 0, 255),
array($CONFIG['user_field1_name'], 'user1', 0, 255),
array($CONFIG['user_field2_name'], 'user2', 0, 255),
array($CONFIG['user_field3_name'], 'user3', 0, 255),
array($CONFIG['user_field4_name'], 'user4', 0, 255),
array($CONFIG['user_field5_name'], 'user5', 0, 255),
array($CONFIG['user_field6_name'], 'user6', 0, 255),
array($CONFIG['user_field7_name'], 'user7', 0, 255),
array($CONFIG['user_field8_name'], 'user8', 0, 255),
);
just incase you have copied and pasted and just changed the values with flash gordan's speed but no presision, take a look again and make sure you changed the ['user_fieldX_name'] and the 'userX' next to it ...
okay next find the code $aid = $superCage->post->getInt("aid$pid");
$title = get_post_var('title', $pid);
$caption = get_post_var('caption', $pid);
$keywords = get_post_var('keywords', $pid);
$user1 = get_post_var('user1', $pid);
$user2 = get_post_var('user2', $pid);
$user3 = get_post_var('user3', $pid);
$user4 = get_post_var('user4', $pid);
and add to it so it looks like this $aid = $superCage->post->getInt("aid$pid");
$title = get_post_var('title', $pid);
$caption = get_post_var('caption', $pid);
$keywords = get_post_var('keywords', $pid);
$user1 = get_post_var('user1', $pid);
$user2 = get_post_var('user2', $pid);
$user3 = get_post_var('user3', $pid);
$user4 = get_post_var('user4', $pid);
$user5 = get_post_var('user5', $pid);
$user6 = get_post_var('user6', $pid);
$user7 = get_post_var('user7', $pid);
$user8 = get_post_var('user8', $pid);
are you catching my drift ??
the next code is around line 290 by now .. it depends on how many fields you been adding
look for this code that will update your pictures $update = "aid = '$aid'";
$update .= ", title = '$title'";
$update .= ", caption = '$caption'";
$update .= ", keywords = '$keywords'";
$update .= ", user1 = '$user1'";
$update .= ", user2 = '$user2'";
$update .= ", user3 = '$user3'";
$update .= ", user4 = '$user4'";
..... haaaa yea you guest it it should now look like this$update = "aid = '$aid'";
$update .= ", title = '$title'";
$update .= ", caption = '$caption'";
$update .= ", keywords = '$keywords'";
$update .= ", user1 = '$user1'";
$update .= ", user2 = '$user2'";
$update .= ", user3 = '$user3'";
$update .= ", user4 = '$user4'";
$update .= ", user5 = '$user5'";
$update .= ", user6 = '$user6'";
$update .= ", user7 = '$user7'";
$update .= ", user8 = '$user8'";
..okay so now that we have our edit and updating script up to date ,, we can move on to the next step ....after having a nice cup of coffie/smoke
-
Step5.Editing/modifing the edit_one_pic.php file
okay so lets take a look here this is almost the same as the previous one so lets start with the 1st piece of code
here is the first code to be altered //Check if the form token is valid
if(!checkFormToken()){
cpg_die(ERROR, $lang_errors['invalid_form_token'], __FILE__, __LINE__);
}
$pid = $superCage->post->getInt('id');
$aid = $superCage->post->getInt('aid');
$pwidth = $superCage->post->getInt('pwidth');
$pheight = $superCage->post->getInt('pheight');
$title = cpgSanitizeUserTextInput($superCage->post->getEscaped('title'));
$caption = cpgSanitizeUserTextInput($superCage->post->getEscaped('caption'));
$keywords = cpgSanitizeUserTextInput(utf_replace($superCage->post->getEscaped('keywords')));
$user1 = cpgSanitizeUserTextInput($superCage->post->getEscaped('user1'));
$user2 = cpgSanitizeUserTextInput($superCage->post->getEscaped('user2'));
$user3 = cpgSanitizeUserTextInput($superCage->post->getEscaped('user3'));
$user4 = cpgSanitizeUserTextInput($superCage->post->getEscaped('user4'));
just add at the bottom $user5 = cpgSanitizeUserTextInput($superCage->post->getEscaped('user5'));
etc ... etc....
next this code we will be looking for$update .= ", user4 = '{$user4}'";
and we will simply ass .... oops i mean add$update .= ", user5 = '{$user5}'";
and so forth and so on ! etc etc......
now look for this code$THUMB_ROWSPAN = 7;
then change the 7 to the amount of fields you need +3 for spacing (when adding 4 the code should be : $THUMB_ROWSPAN = 11;
this code you should find around line 358
now just below that is this code if ($CONFIG['user_field1_name'] != '') {
$THUMB_ROWSPAN++;
}
if ($CONFIG['user_field2_name'] != '') {
$THUMB_ROWSPAN++;
}
if ($CONFIG['user_field3_name'] != '') {
$THUMB_ROWSPAN++;
}
if ($CONFIG['user_field4_name'] != '') {
$THUMB_ROWSPAN++;
}
add onto this codeif ($CONFIG['user_field5_name'] != '') {
$THUMB_ROWSPAN++;
}
etc....
so at the end the code should look like this :if ($CONFIG['user_field1_name'] != '') {
$THUMB_ROWSPAN++;
}
if ($CONFIG['user_field2_name'] != '') {
$THUMB_ROWSPAN++;
}
if ($CONFIG['user_field3_name'] != '') {
$THUMB_ROWSPAN++;
}
if ($CONFIG['user_field4_name'] != '') {
$THUMB_ROWSPAN++;
}
if ($CONFIG['user_field5_name'] != '') {
$THUMB_ROWSPAN++;
}
if ($CONFIG['user_field6_name'] != '') {
$THUMB_ROWSPAN++;
}
if ($CONFIG['user_field7_name'] != '') {
$THUMB_ROWSPAN++;
}
if ($CONFIG['user_field8_name'] != '') {
$THUMB_ROWSPAN++;
}
next find the code aroundabout line 600if ($CONFIG['user_field4_name'] != '') {
echo <<< EOT
<tr>
<td class="tableb" style="white-space: nowrap;">
{$CONFIG['user_field4_name']}
</td>
<td width="100%" class="tableb" valign="top">
<input type="text" style="width: 100%" name="user4" maxlength="255" value="{$CURRENT_PIC['user4']}" class="textinput" />
</td>
</tr>
EOT;
}
then just addif ($CONFIG['user_field5_name'] != '') {
echo <<< EOT
<tr>
<td class="tableb" style="white-space: nowrap;">
{$CONFIG['user_field5_name']}
</td>
<td width="100%" class="tableb" valign="top">
<input type="text" style="width: 100%" name="user5" maxlength="255" value="{$CURRENT_PIC['user5']}" class="textinput" />
</td>
</tr>
EOT;
}
look carefully so you dont miss one of the number that you need to change there are 4 changes in each area .
i hope you are still on the bandwaggon ! if not download the download files and revise them but for those of you who are still with me lets go to the next step ! others revise before proceeding
snort snort ,,,,, mmmmm a minute break
-
Step6.Editing/modifing the upload.php file
lets open that upload.php thing ..
look for this code it should be around line 755if(!empty($CONFIG['user_field4_name'])) {
$form_array[] = array($CONFIG['user_field4_name'], 'user4', 0, 255, 1);
}
then just add the nessasery below if(!empty($CONFIG['user_field5_name'])) {
$form_array[] = array($CONFIG['user_field5_name'], 'user5', 0, 255, 1);
}
if(!empty($CONFIG['user_field6_name'])) {
$form_array[] = array($CONFIG['user_field6_name'], 'user6', 0, 255, 1);
}
etc.etc......
-
Step7.Editing/modifing the "Thumbnails.php"
open Thumbnails.php and look for the code :// find out if a parameter has been submitted at all
$allowed = array('title', 'caption', 'keywords', 'filename', 'pic_raw_ip', 'pic_hdr_ip', 'user1', 'user2', 'user3', 'user4');
and then add ,'user5', 'user6'
there is no comma after the last field you insert .
save the file ..
before proceeding to the next section where we will be working in diffrent folders , i want to add something
if your users are using XP publisher to upload photos you will have to update the xp_publish.php aswell
in there find the code // Add a picture
function process_picture()
{
global $CONFIG, $IMG_TYPES;
global $lang_db_input_php, $lang_errors;
$superCage = Inspekt::makeSuperCage();
@unlink(LOGFILE);
if (!USER_ID || !USER_CAN_UPLOAD_PICTURES) simple_die(ERROR, $lang_errors['perm_denied'], __FILE__, __LINE__);
//$album = (int)$_GET['album'];
$album = $superCage->get->getInt('album');
$title = '';
$caption = '';
$keywords = '';
$user1 = '';
$user2 = '';
$user3 = '';
$user4 = '';
and just add$user5 = '';
etc. to the bottom .
awesome stuff ..
-
Step8.Editing/modifing the
include/search.inc.php
this is my Favourite one because i think all the people seaching my pictures :-) ahhhhh
okay look for code$allowed = array('title', 'caption', 'keywords', 'filename', 'pic_raw_ip', 'pic_hdr_ip', 'user1', 'user2', 'user3', 'user4');
then add 'user5', 'user6', etc.etc.....
just in case you get the commas wrong here is a example$allowed = array('title', 'caption', 'keywords', 'filename', 'pic_raw_ip', 'pic_hdr_ip', 'user1', 'user2', 'user3', 'user4', 'user5', 'user6', 'user7', 'user8');
save search.inc.php
-
Step9.Editing/modifing the "include/picmgmt.inc.php"
look for this code// Add a picture to an album
function add_picture($aid, $filepath, $filename, $position = 0, $title = '', $caption = '', $keywords = '', $user1 = '', $user2 = '', $user3 = '', $user4 = '', $category = 0, $raw_ip = '', $hdr_ip = '', $iwidth = 0, $iheight = 0)
{
and change it to// Add a picture to an album
function add_picture($aid, $filepath, $filename, $position = 0, $title = '', $caption = '', $keywords = '', $user1 = '', $user2 = '', $user3 = '', $user4 = '', $user5 = '', $user6 = '', $user7 = '', $user8 = '', $category = 0, $raw_ip = '', $hdr_ip = '', $iwidth = 0, $iheight = 0)
{
now find // Populate Array to pass to plugins, then to SQL
$CURRENT_PIC_DATA['aid'] = $aid;
$CURRENT_PIC_DATA['filepath'] = $filepath;
$CURRENT_PIC_DATA['filename'] = $filename;
$CURRENT_PIC_DATA['filesize'] = $image_filesize;
$CURRENT_PIC_DATA['total_filesize'] = $total_filesize;
$CURRENT_PIC_DATA['pwidth'] = $imagesize[0];
$CURRENT_PIC_DATA['pheight'] = $imagesize[1];
$CURRENT_PIC_DATA['owner_id'] = $user_id;
$CURRENT_PIC_DATA['title'] = $title;
$CURRENT_PIC_DATA['caption'] = $caption;
$CURRENT_PIC_DATA['keywords'] = $keywords;
$CURRENT_PIC_DATA['approved'] = $approved;
$CURRENT_PIC_DATA['user1'] = $user1;
$CURRENT_PIC_DATA['user2'] = $user2;
$CURRENT_PIC_DATA['user3'] = $user3;
$CURRENT_PIC_DATA['user4'] = $user4;
$CURRENT_PIC_DATA['pic_raw_ip'] = $raw_ip;
$CURRENT_PIC_DATA['pic_hdr_ip'] = $hdr_ip;
$CURRENT_PIC_DATA['position'] = $position;
$CURRENT_PIC_DATA = CPGPluginAPI::filter('add_file_data',$CURRENT_PIC_DATA);
and modify to look like this // Populate Array to pass to plugins, then to SQL
$CURRENT_PIC_DATA['aid'] = $aid;
$CURRENT_PIC_DATA['filepath'] = $filepath;
$CURRENT_PIC_DATA['filename'] = $filename;
$CURRENT_PIC_DATA['filesize'] = $image_filesize;
$CURRENT_PIC_DATA['total_filesize'] = $total_filesize;
$CURRENT_PIC_DATA['pwidth'] = $imagesize[0];
$CURRENT_PIC_DATA['pheight'] = $imagesize[1];
$CURRENT_PIC_DATA['owner_id'] = $user_id;
$CURRENT_PIC_DATA['title'] = $title;
$CURRENT_PIC_DATA['caption'] = $caption;
$CURRENT_PIC_DATA['keywords'] = $keywords;
$CURRENT_PIC_DATA['approved'] = $approved;
$CURRENT_PIC_DATA['user1'] = $user1;
$CURRENT_PIC_DATA['user2'] = $user2;
$CURRENT_PIC_DATA['user3'] = $user3;
$CURRENT_PIC_DATA['user4'] = $user4;
$CURRENT_PIC_DATA['user5'] = $user5;
$CURRENT_PIC_DATA['user6'] = $user6;
$CURRENT_PIC_DATA['user7'] = $user7;
$CURRENT_PIC_DATA['user8'] = $user8;
$CURRENT_PIC_DATA['pic_raw_ip'] = $raw_ip;
$CURRENT_PIC_DATA['pic_hdr_ip'] = $hdr_ip;
$CURRENT_PIC_DATA['position'] = $position;
$CURRENT_PIC_DATA = CPGPluginAPI::filter('add_file_data',$CURRENT_PIC_DATA);
make sure you change both values in each field
next we will look for this code ,,,,,$query = "INSERT INTO {$CONFIG['TABLE_PICTURES']} (aid, filepath, filename, filesize, total_filesize, pwidth, pheight, ctime, owner_id, title, caption, keywords, approved, user1, user2, user3, user4, pic_raw_ip, pic_hdr_ip, position) VALUES
and add "user5, user6" etc etc.....
next phase look just below that there you will find'{$CURRENT_PIC_DATA['user4']}',
now just add '{$CURRENT_PIC_DATA['user5']}','{$CURRENT_PIC_DATA['user6']}',
etc.etc.....
now its time to have a soul shakedown !!
-
Step10.Editing/modifing the "include/admin.inc.php"
look for this code
'custom_fields_image_description' => array(
'user_field1_name' => array(
'type' => 'textfield',
'default_value' => '',
'help_link' => 'f=configuration.htm&as=admin_custom_image&ae=admin_custom_image_end',
),
'user_field2_name' => array(
'type' => 'textfield',
'default_value' => '',
'help_link' => '',
),
'user_field3_name' => array(
'type' => 'textfield',
'default_value' => '',
'help_link' => '',
),
'user_field4_name' => array(
'type' => 'textfield',
'default_value' => '',
'help_link' => '',
),
then add to the bottom , 'user_field5_name' => array(
'type' => 'textfield',
'default_value' => '',
'help_link' => '',
),
'user_field6_name' => array(
'type' => 'textfield',
'default_value' => '',
'help_link' => '',
),
etc..ect....
Instructions continue on the next page - use the pagination link to go to the second page of this thread.
-
Step11.Editing/modifing the "include/functions.inc.php"
look for code//if ($CONFIG['display_uploader']) {
$select_column_list[] = 'r.owner_id';
//}
if (GALLERY_ADMIN_MODE) {
$select_column_list[] = 'pic_raw_ip';
$select_column_list[] = 'pic_hdr_ip';
}
for ($i = 1; $i <= 4; $i++) {
if ($CONFIG['user_field' . $i . '_name']) {
$select_column_list[] = 'user' . $i;
}
}
}
and change to 4 to the number you require according to the fields you inculdefor ($i = 1; $i <= 8; $i++) {
-
Be Sure to save all the files and load into your browser
login as Admin > go to config > Custom fields for image description > now add the names you want to call the fields and now you have some extra info for your pictures ! quite cool don't you think
if you need the download files you can get them here
have a awesome day and remember ,, Increase the Peace!
Instructions for this mod end here.
-
Well Thanx for the tips on my page ,, i fixed the spelling(the worst of it) and the file name's ,, ill make my next tutorial and have you as a critic again .. i really appreciate all the tips you gave me on the site but i think some of the things you said you could have put in a private message like all the ones where you tell me off personally .. but i made this tutorial double speed and just wanted to get it out there for the guys to be able to fix there problem .. that why there where so many mistakes and i did not really revise much . but all the tips you gave are great and i will surly take into consideration next time
and for the "newbies ",if there are unclear areas on the tutorial please post the area you are stuck at and ill elaborate on that step some more !
-
Thank you very much! I'm about to try this out, so I'll let you know the results.
-
Thank you so much!
I successfully added additional custom fields in 1.5.6 thanks to this mod.
Aside from performing the steps described in the tutorial, I modified the following files:
*lang/english.php
Find the line "$lang_admin_php['user_field1_name'] = 'Field 1 name'; // cpg1.5" and add similar lines for user_field5_name, user_field6_name, etc.
*search.php
Find the line "foreach (range(1, 4) as $i) {" and replace "4" by the new number of custom fields.
-
hey dude if you use this link http://www.bloggersplace.com/tutorials/ (http://www.bloggersplace.com/tutorials/)i have made a tutorial but please do remember to backup your files when you attempt this update .. let me know when you get stuck ,, peace out .
-
You already mentioned your tutorial in this thread on the first page. My remarks in reply #8 (http://forum.coppermine-gallery.net/index.php/topic,64341.msg320063.html#msg320063) apply just as well. Locking.