Extra fields - Description, location, whatever you like
joan
![]()
Joined: 2002-10-21
Posts: 3473 |
![]() |
***NEWS FLASH*** This patch is no longer availble. The changes have been rolled into 1.3.4, and are now called Custom Fields. This thread is now locked. Please start a thread in a suitable forum for any discussion on Custom Fields. I've written a hack that enables you to define any fields you like to be attached to images. You can define default fields that will be available in every new album, and this list can then be individually tailored on an album by album basis or based on nested albums. The fields are searchable. The fields can be edited for each image in the edit_captions window, and each one that is defined will be displayed under the caption and before the comments on the photo page. Anyone interested in this? |
|
dtdgoomba
Joined: 2002-11-04
Posts: 185 |
![]() |
yes, definitely interested and I would say a lot of people are since in the last week, I've noticed like 2 threads or more on it :smile: Looks great! |
|
MysticGirl
![]()
Joined: 2003-01-06
Posts: 81 |
![]() |
Oh bless you sweet, sweet heart!!! :lol: I have been trying to get this to work myself! I am very interested in this. |
|
pbyjp
![]()
Joined: 2002-11-12
Posts: 260 |
![]() |
I think you'll get another vote from me! |
|
joan
![]()
Joined: 2002-10-21
Posts: 3473 |
![]() |
[edited 15 June, 03] To install, get the file <!-- BBCode Start --><A HREF="http://www.mcgalliard.org/content/gallery/extra_fields_new.zip" TARGET="_blank">extra_fields_new.zip</A><!-- BBCode End --> and unzip it. Copy extra_fields.php to your gallery directory, then change to your gallery directory, user configure.(sh|bat) to make sure you can write to the setup directory, and apply the patch. Eg: To use the new fields, go to an album to which you can write, and click on the new option extra fields. In the popup window, type in the number of new fields you want in this album, and click Apply. Then type a unique key name for each of the new fields, and click Apply again. Now, when you pop up the edit caption window for any of the images in that album, you can populate these new fields. That's the basics. Here's few minor points. Search will go through every one of these fields, and display the key name,. as well as the text, for matching fields Extra fields are inheritied in nested albums and can be applied to nested albums. You can use the configuration wizard to set up default extra fields for the gallery. Any fields with values in them are displayed on the image page If they are undefined, or an empty string, they are not displayed. The patch was build against RELEASE_1_3_3. It has not been tested against earlier versions. If you have the latest CVS, you will get an error when patching do_command.php. That's because some code has been turned into a function, and moved from do_command.php to util.php. To make the change by hand, leave do_command.php as it is and open util.php in your favourite editor, find this line: |
|
MysticGirl
![]()
Joined: 2003-01-06
Posts: 81 |
![]() |
This works great Joan! Thanks. I was looking for something that was a global (pre-arranged) setup - something the users couldn't change. So, when someone uploads a picture, the extra fields are already there for them to enter the information. But, I should be able to figure something out based on this. You are a life saver! :grin: |
|
maccas
Joined: 2003-01-11
Posts: 16 |
![]() |
I have made a extra field called title, how could I add this in the <title> tag and not on the page itself, if posible? |
|
joan
![]()
Joined: 2002-10-21
Posts: 3473 |
![]() |
Quote:
I have made a extra field called title, how could I add this in the <title> tag and not on the page itself, if posible? Just a matter of coding it up. Open view_photo.php, and find <head>. Put this immediately below it: and in the line below, change You'll still have the title below the image as well, but fixing this is left as an exercise for the reader |
|
joan
![]()
Joined: 2002-10-21
Posts: 3473 |
![]() |
Sharp eyed readers will have noticed that there were a couple of problems with above patch. They are to do with the way the way default values are stored. If you've already installed the patch, and are happy with it - leave it as it is. If you do want to update your code, I've put a patch file up at <!-- BBCode Start --><A HREF="http://www.mcgalliard.org/content/gallery/extra_fields_update.patch" TARGET="_blank">extra_fields_update.patch</A><!-- BBCode End --> If you haven't installed thee patch yet, then just grab the new one:<!-- BBCode Start --><A HREF="http://www.mcgalliard.org/content/gallery/extra_fields_new.zip" TARGET="_blank">extra_fields_new.zip</A><!-- BBCode End --> |
|
psjames
Joined: 2002-10-11
Posts: 19 |
![]() |
It would be nice if the extra fields could be added into captionator.php. If it could be done could somebody post the code. Thank you, |
|
joan
![]()
Joined: 2002-10-21
Posts: 3473 |
![]() |
<!-- BBCode Start --><TABLE BORDER=0 ALIGN=CENTER WIDTH=85%><TR><TD><font class="pn-sub">Code:</font><HR></TD></TR><TR><TD><FONT class="pn-sub"><PRE> $i++; + <?php </TD></TR></TABLE><!-- BBCode End --> |
|
cyberlok
![]()
Joined: 2003-01-14
Posts: 6 |
![]() |
I agree with everyone else. This has been a long time comming and I cant wait to try and apply it to my gallery. I wish my hoster has shell it would make patching way easier. |
|
D-Iivil
![]()
Joined: 2003-01-18
Posts: 12 |
![]() |
Ok... I screwed up myseld :smile: I didn't kow what a hell to do with .patch file so I uploaded those two files and ran extra_fields.php |
|
joan
![]()
Joined: 2002-10-21
Posts: 3473 |
![]() |
D-Iivil Oh no! Don't know what happened to you, but here's a hint. List all your files in the gallery directory with the dates, and see which ones have changed most recently, and restore them. Generally, always make a backup (of your gallery andalbum directories) before installing any new code. |
|
joan
![]()
Joined: 2002-10-21
Posts: 3473 |
![]() |
Quote:
I agree with everyone else. This has been a long time comming and I cant wait to try and apply it to my gallery. I wish my hoster has shell it would make patching way easier. Well, if you are running a pure 1.3.3 install, you could just copy the files over. The complete set of changed files is at <!-- BBCode Start --><A HREF="http://www.mcgalliard.org/content/gallery/extra_fields_files.zip" TARGET="_blank">extra_fields_files.zip</A><!-- BBCode End --> If you need to run patch from your windows machine, you can get it (along with 100+ other programs) at <!-- BBCode Start --><A HREF="http://unxutils.sourceforge.net/" TARGET="_blank">http://unxutils.sourceforge.net/</A><!-- BBCode End --> |
|
Gaile
Joined: 2002-07-20
Posts: 1301 |
![]() |
Hi Joan This is GREAT! I discovered I have shell access and ran the first patch (extra_fields.patch). Because I was using a later version of Gallery I had to do the one manual change you mentioned and it all worked. Just now I tried to apply the extra_fields_update.patch, and got the following message: I used: patch -p0 < extra_fields_update.patch -- should I have done something differently or am I going to have to try something else? (new to this - so try to explain in LOW tech terminology if possible! Thanks!) :smile: Gaile |
|
joan
![]()
Joined: 2002-10-21
Posts: 3473 |
![]() |
Oops! Permissions! I forgot to mention you need to run joan |
|
D-Iivil
![]()
Joined: 2003-01-18
Posts: 12 |
![]() |
Quote:
D-Iivil Lucky me, I had a backup from day ago... so I'm running fine again :wink: |
|
psjames
Joined: 2002-10-11
Posts: 19 |
![]() |
Thank you for the code. I am running 1.3.4 b11 and everything is working great. I had to manually place the code that your patch puts into do_command.php into util.php. I have also placed the additional code into captionator.php and it works great. Thank you, Paul James |
|
Agatka
![]()
Joined: 2002-10-19
Posts: 140 |
![]() |
Hello, I would like to try it, but I don't have shell access and have no idea how to implement these changes. I looked at the file and I don't know what "!" mean. Anyway, I have version 1.3.2 and looks like some of the files are diferent. Is there an easier way than manually adding code? I tried and got weird errors. Thanks, |
|
joan
![]()
Joined: 2002-10-21
Posts: 3473 |
![]() |
Quote:
Hello, It's based on 1.3.3. You probably should think about upgrading to 1.3.3, read <!-- BBCode Start --><A HREF="http://gallery.menalto.com/modules.php?op=modload&name=News&file=article&sid=65&mode=thread&order=0&thold=0" TARGET="_blank">this</A><!-- BBCode End --> . If you do that, you can then just copy the files in <!-- BBCode Start --><A HREF="http://www.mcgalliard.org/content/gallery/extra_fields_files.zip" TARGET="_blank">extra_fields_files.zip</A><!-- BBCode End --> Otherwise, the best idea would be to copy all your files to your local machine (windows, right?), get patch.exe from http://unxutils.sourceforge.net/, apply the patch If you must do it by hand, "+" means "add this line", "-" means "delete this line" and "!" means "change this line" |
|
psjames
Joined: 2002-10-11
Posts: 19 |
![]() |
Quote:
<!-- BBCode Start --><TABLE BORDER=0 ALIGN=CENTER WIDTH=85%><TR><TD><font class="pn-sub">Code:</font><HR></TD></TR><TR><TD><FONT class="pn-sub"><PRE> I am getting the following error when I try and save: |
|
joan
![]()
Joined: 2002-10-21
Posts: 3473 |
![]() |
Quote:
I am getting the following error when I try and save: Sorry about that - it was a bit of a quick knockup, so I never tested it with no extra fields defined. all you need to do is wrap an if clause around the for loop: |
|
psjames
Joined: 2002-10-11
Posts: 19 |
![]() |
Thanks that solved my problem. PJ |
|
joan
![]()
Joined: 2002-10-21
Posts: 3473 |
![]() |
I've made an extra tweak to this: added two new features.
The special fields are Title, Upload Date and Capture Date. If Title is defined, then it will be displayed in the page title, as well as under the photo. If the date fields are defined, the values already stored with each photo will displayed. When displaying text fields, every embedded "n" will be replaced with a <p>, so the paragraph structure will be retained. To patch from 1.3.3 to this version, get the file <!-- BBCode Start --><A HREF="http://www.mcgalliard.org/content/gallery/extra_fields_new_2.zip" TARGET="_blank">http://www.mcgalliard.org/content/gallery/extra_fields_new_2.zip</A><!-- BBCode End --> and apply the patch. If you've already installed the extra_fields_new.zip version, you can patch it with <!-- BBCode Start --><A HREF="http://www.mcgalliard.org/content/gallery/extra_fields_update_2.patch" TARGET="_blank">extra_fields_update_2.patch</A><!-- BBCode End -->. If you want all changed files, then get <!-- BBCode Start --><A HREF="http://www.mcgalliard.org/content/gallery/extra_fields_files_2.zip" TARGET="_blank">extra_fields_files_2.zip</A><!-- BBCode End -->. Phew! joan[/] |
|
psjames
Joined: 2002-10-11
Posts: 19 |
![]() |
I took the extra_fields_files_2.zip and replaced my files and I am now getting the following error: any suggestions? |
|
joan
![]()
Joined: 2002-10-21
Posts: 3473 |
![]() |
Quote:
I took the extra_fields_files_2.zip and replaced my files and I am now getting the following error: Looks like maybe all the files from the zip haven't been updated in your directory. Open util.php. restoreQuotes should be the last function in it. If it's not, you need to get the version from extra_fields_files_2.zip, and copy it into the directory. |
|
joan
![]()
Joined: 2002-10-21
Posts: 3473 |
![]() |
Quote:
This works great Joan! Thanks. I was looking for something that was a global (pre-arranged) setup - something the users couldn't change. So, when someone uploads a picture, the extra fields are already there for them to enter the information. But, I should be able to figure something out based on this. You are a life saver! :grin: I thought this was worth while, so added one more patch: <!-- BBCode Start --><A HREF="http://www.mcgalliard.org/content/gallery/extra_fields_upload.zip" TARGET="_blank">extra_fields_upload.zip</A><!-- BBCode End --> This is in addition to all the others, and adds a new option on the album page, add photo. This will allow you to fill in all extra fields defined for this album at upload time. |
|
MysticGirl
![]()
Joined: 2003-01-06
Posts: 81 |
![]() |
Hi Joan, I just got around to trying this one out. Your add_photo.php has taken out a bunch of the features I liked in the original version. I tried to go through and add the different pieces of code to add_photos.php and save_photos.php, but I got some errors. I even tried adding the extra stuff from both files into your customized file, but I didn't get it right either. If you get a chance, could you add to the patch file the necessary changes that need to be made to add_photos.php and save_photos.php? Or just tell me here if you don't feel like patching it... |
|
gothballoon
![]()
Joined: 2003-02-17
Posts: 68 |
![]() |
Joan i am getting 2 odd errors i thought maybe you might be able to help me figure this out $numPhotos = $gallery->album->numPhotos($gallery->user->canWriteToAlbum($gallery->album)); when i try to change the name of an added caption $gallery->album->setExtraFields($extra_fields); |
|
joan
![]()
Joined: 2002-10-21
Posts: 3473 |
![]() |
Quote:
Hi Joan, I just got around to trying this one out. Your add_photo.php has taken out a bunch of the features I liked in the original version. I tried to go through and add the different pieces of code to add_photos.php and save_photos.php, but I got some errors. I even tried adding the extra stuff from both files into your customized file, but I didn't get it right either. If you get a chance, could you add to the patch file the necessary changes that need to be made to add_photos.php and save_photos.php? Or just tell me here if you don't feel like patching it... I don't really understand what you are trying to do. I've only removed the things that make no sense in this context. Say if you had 3 extra fields. Then if you could set each field on multiple uploads, you'd have 25 text areas to fill in. This seemed impractical, so I didn't allow multiple files. Similary, a zip file or a URL could contain any number of images - how would you allow the user to input all the values required, and match them up with the right images? I haven't been near gallery remote, so that's not included eiterh. Any volunteers? So I decided to only allow the user to set the extra fields on upload if s/he was uploading a single file. If s/he was uploading multiple files, s/he'd have to populate the extra fields later, using "edit caption". If you can describe - from a user viewpoint - what you want to achieve, I see if I can help you. |
|
joan
![]()
Joined: 2002-10-21
Posts: 3473 |
![]() |
Quote:
Joan i am getting 2 odd errors i thought maybe you might be able to help me figure this out Please try to be specific: captionator.php or edit_captions.php? |
|
gothballoon
![]()
Joined: 2003-02-17
Posts: 68 |
![]() |
each one depending on what i am doing when changing the extra feild names it pops up in the extra_feilds.php with when going to add captions is shows up in the captionator.php with I was hoping that maybe the two errors may be some how linked by one of the class files or something. |
|
joan
![]()
Joined: 2002-10-21
Posts: 3473 |
![]() |
Let's try some diagnostics. print "gallery<br>"; var_dump($gallery); print "<p>"; and $gallery->album->setExtraFields($extra_fields); |
|
gothballoon
![]()
Joined: 2003-02-17
Posts: 68 |
![]() |
Joan sounds great but whare do i put it? :grin: |
|
joan
![]()
Joined: 2002-10-21
Posts: 3473 |
![]() |
They're diagnostic print statements - the go just above the line of code you are getting an error on (see, i have included the two lines of code you reported as giving an error). Then, when you visit the page, you will get a lot of rubbish. Cut and paste that into a PM to me. |
|
matadler
Joined: 2003-01-23
Posts: 11 |
![]() |
Hi! A nice feature would be a field named 'Camera', which reads the EXIF data and displays the camera model. If there's no EXIF data available one should be able to enter the camera model manually. :grin: Mathias |
|
joan
![]()
Joined: 2002-10-21
Posts: 3473 |
![]() |
Quote:
Hi! Good suggestion. I'm not modifying this for a while, because I am waiting to see if it becomes part of gallery 1.3.4. I'll note down this as a feature request. |
|
fingery
![]()
Joined: 2003-03-15
Posts: 38 |
![]() |
I must be simple....having problems here. I have shell access. I've upload the 2 files to to the gallery directory and have run sh configure.sh. Where is patch? Is it a Nuke thing or something? How do i install/run the patch? Thanks in advance. Chris |
|
joan
![]()
Joined: 2002-10-21
Posts: 3473 |
![]() |
Quote:
I must be simple....having problems here. I'm not surprised, this is getting complicated. I'm losing track. First, make sure you've got the latest version. Get if from <!-- BBCode Start --><A HREF="http://sourceforge.net/tracker/index.php?func=detail&aid=692300&group_id=7130&atid=307130" TARGET="_blank">Sourceforge</A><!-- BBCode End --> Then go back to the beginning of this thread, and read the posting by me on the 6 Feb, particularly this part: Quote:
To install, get the file extra_fields_new.zip and unzip it. Copy extra_fields.php to your gallery directory, then change to your gallery directory, user configure.(sh|bat) to make sure you can write to the setup directory, and apply the patch. Eg: Let me know how you do. |
|
fingery
![]()
Joined: 2003-03-15
Posts: 38 |
![]() |
Sorry Joan, just looked at my last post and it wasn't very clear. When i said it doesnt look like i've got the patch i meant the patch program (i presume). bash: patch: command not found Any ideas? Thanks in advance, Chris |
|
Amberlight
Joined: 2003-03-29
Posts: 2 |
![]() |
Hi Joan, I'm a total newbie, so forgive me. I am very very much in need of the extra fields scrip you've written, but I am not at all familiar with SSH. My partner does most of my code work, and he's asking me if I can get the ftp commands to accomplish this. Am I way off base? Can you enlighten me? And while I have your often bent ear, can you tell me where to change the text and link color of the main gallery page? We found the style sheet you instructed in another string that changes the page color, but no luck on the text. Your wisdom is much appreciated! :roll: |
|
joan
![]()
Joined: 2002-10-21
Posts: 3473 |
![]() |
Amberlight, Fingerly, Instructions on patching found in this thread: <!-- BBCode Start --><A HREF="http://gallery.menalto.com/modules.php?op=modload&name=phpBB_14&file=index&action=viewtopic&topic=4936&2" TARGET="_blank">patch question</A><!-- BBCode End --> Text and link colour: copy css/standalone_style.css.default to css/standalone_style.css. Link colours should be obvious, and text is in the TD, P section. |
|
Amberlight
Joined: 2003-03-29
Posts: 2 |
![]() |
Hi Joan, Thank you for your help. Sadly, your advice is still over my partner's head (way over mine) so we've had no luck making it all work. Would you or anyone else you can reccomend have the time to help me add your new field customization and make a few other code edits for me? I am obviously willing to pay. Can someone hold my newbie hand? :cry: my email is wayne@caparas.com. |
|
skicrave
Joined: 2002-10-25
Posts: 89 |
![]() |
Thanks for the great mod Joan. I'm not to familar with the Gallery database scheme, so I was wondering if you could answer a quick question for me. Can this same method be applied to albums (with the appropriate changes of course)? Thanks again! |
|
tessa
Joined: 2003-03-13
Posts: 35 |
![]() |
I think I killed my gallery. :sad: I was trying the installation on my files. I don't have shell access only FTP. So I tried to make the changes myself. Now I cannot even get the config.php page to come up to attempt to see if my changes work. The error i'm getting is: Fatal error: Call to undefined function: broken_link() in /home/spa/public_html/spagallery/util.php on line 874 I have uploaded my original files back to my server. I not shure how to go about placing this code. I have read and re-read the patch tutorial, but it doesn't seem to work for me either. I have downloaded the http://unxutils.sourceforge.net/ --->not sure how to use this, or if I can use it. Index: captionator.php I went to line 67-72 (original file) and copied from the patch file and placed the code from 67 to 69. I will try again, of course, but i'm not sure what i'm doing wrong. |
|
joan
![]()
Joined: 2002-10-21
Posts: 3473 |
![]() |
Not sure what you're doing, but if you see this $i++; then you need to find this line: Is that what you're doing? |
|
CHEETAH
![]()
Joined: 2003-02-26
Posts: 37 |
![]() |
ok am i dumb or what? i cant get this to work! I uplaoded "extra_fields.php" to the gallery directory, "extra_fields_new.patch" to the setup-directory inside the gallery directory, went to the gallery-directory with the ssh-thing on my webserver, said sh configure.sh, went to the setup directory, wrote patch -p0 < extra_fields_new.patch and got this: jailshell -2. 05a$ cd setup so what did i do wrong!=????? thx for help! |
|
joan
![]()
Joined: 2002-10-21
Posts: 3473 |
![]() |
Quote:
ok am i dumb or what? i cant get this to work! I uplaoded "extra_fields.php" to the gallery directory, "extra_fields_new.patch" to the setup-directory inside the gallery directory, went to the gallery-directory with the ssh-thing on my webserver, said sh configure.sh, went to the setup directory, wrote patch -p0 < extra_fields_new.patch and got this: Not sure why you are going to the setup directory: DON'T! move the patch to your /gallery directory, and run it from there. |
|
CHEETAH
![]()
Joined: 2003-02-26
Posts: 37 |
![]() |
Quote:
>> ok am i dumb or what? i cant get this to work! I uplaoded "extra_fields.php" to the gallery directory, "extra_fields_new.patch" to the setup-directory inside the gallery directory, went to the gallery-directory with the ssh-thing on my webserver, said sh configure.sh, went to the setup directory, wrote patch -p0 < extra_fields_new.patch and got this: oh ok gonna try that one then! :razz: |
|
CHEETAH
![]()
Joined: 2003-02-26
Posts: 37 |
![]() |
One question: i can only edit the extra fields pic by pic, gong in the edit photo-dropmenu and choose edit caption. how to make it possible to edit them through "[captions]" in that gallery's menu, and edit them all at once? |
|