How to increase custom fields length to be more than 255 characters

inka

Joined: 2006-02-15
Posts: 6
Posted: Sat, 2006-06-17 14:01

Hi!

Just want to share how to overcome the limitation of max. 255 characters in custom fields.

Two changes are needed:

1. DB change

If using phpMyAdmin
a) Go to table g2_CustomFieldMap
b) Mark field g_value
c) Select change pen
d) Change type to be TEXT instead of VARCHAR
e) Save the change
In my case already entered values in g_value where kept in the DB.

2. Change Maps.inc
a) Open file /gallery2/modules/customfield/classes/Maps.inc
b) Change 'value'=>array('type'=>STORAGE_TYPE_STRING to 'value'=>array('type'=>STORAGE_TYPE_TEXT
c) Be aware that this file was automatically created from Maps.xml

3. Clear DB cache
a) In Gallery go to Site-Administration and Maintenaince
b) Clear the data base buffer (needed in case of manual DB update like under 1. above)

Now, more than 255 characters should be available for the value in all custom fields.

Have fun,
Ingo


Gallery-Version = 2.1.1 Kern 1.1.0.1
PHP-Version = 4.4.0 apache2handler
Webserver = Apache/2.0.54 (Linux/SUSE)
Database = mysql 4.1.13-log, lock.system=flock
Activated toolkits = Exif, Thumbnail, Gd, Getid3
Operating system = Linux sinatra 2.6.13-15-smp #1 SMP Tue Sep 13 14:56:15 UTC 2005 x86_64
Browser = Mozilla/5.0 (X11; U; Linux i686; de-AT; rv:1.7.13) Gecko/20060411

 
Luke79

Joined: 2007-07-22
Posts: 21
Posted: Sun, 2007-07-29 06:58

Thankyou this is just what I needed.

 
ashleyayling

Joined: 2008-02-04
Posts: 4
Posted: Thu, 2008-02-07 09:37

Thanks so much for this, you wont belive how much hassle this has saved me!

 
AntiNSA

Joined: 2009-02-25
Posts: 18
Posted: Thu, 2009-02-26 11:45

Im havign a problem migrating keywords ... so I am reverting thi. anyione else have that problem running this mod?

This forum is a extremely difficult to use in relation to this subject.

 
AntiNSA

Joined: 2009-02-25
Posts: 18
Posted: Fri, 2009-02-27 06:29

THiss is not working.. how to change the maps xml from regenerating the limit?

 
inka

Joined: 2006-02-15
Posts: 6
Posted: Fri, 2009-02-27 22:40

Hi, I am not sure I get you because Maps.xml is not changed. It is just stated that Maps.inc was automatically created from Maps.xml hence it may be an issue under certain circumstances. So it is a warning to consider the situation.

 
aklar
aklar's picture

Joined: 2009-06-22
Posts: 3
Posted: Mon, 2009-06-22 11:08

Thank you for this wonderful, short and precise how-to for a very common wish. I also changed the customfield/classes/Maps.xml just in case.

 
aklar
aklar's picture

Joined: 2009-06-22
Posts: 3
Posted: Wed, 2009-07-22 13:59

Also, it might be a good idea to increase the size of the input field. You can do that by following these simple steps:

1. if you haven't already, create a new directory called "local" in gallery2/modules/customfield/templates
2. copy the file gallery2/modules/customfield/templates/CustomFieldItemEdit.tpl into the directory just created
3. change the lines 30 and 31 (everything between "<input type..." and ".../>") to this:

<textarea cols="40" rows="8" name="{g->formVar var="form[fields][$field]"}">{$value}</textarea>

You can, of course change the size (cols and rows) to whatever you like.

 
lightpainter

Joined: 2005-11-25
Posts: 64
Posted: Fri, 2009-10-02 19:33

I am looking for a solution to this truncation in the original keywords field. This is because I keyword all my images in Lightroom before import, so need the IPTC data to be read into the keyword field. Presumably this cannot be imported into a custom field or am I missing something?
-----------------------------
www.lightpainter.co.uk

 
lindamir
lindamir's picture

Joined: 2009-10-03
Posts: 1
Posted: Sat, 2009-10-03 12:03

Thank you very much for this great explanation. My first problem solved :-)