Custom data

 

How it works

In Basic settings -> I -> Items 11 and 12 of the Photo Albums -> Settings admin page, you can activate the use of Custom Datafields. Each album and each photo (or video or photo with audio) can have up to 10 customized data fields stored with the album / photo info. As soon as you define the Title (= caption) of the field, it exists. You can also decide if a field may be visible, and if a field may be editable at the front-end of the website. The checkboxes on every line in the tables in Advanced settings -> Custom data define if the item may be seen / edited at front-end.

3796

On the Photo Albums -> Album admin -> Edit Album information -> Manage Photos admin page, you will see the input fields for the custom data right below the Description input area.

3797

The photo description may contain wppa keywords w#cc0 .. w#cc9 to display the captions of the custom data fields, w#cd0 .. w#cd9 to display the data of the respective fields. In this example the description reads as follows:

<table><tbody>
<tr><td>w#cc0</td><td>w#cd0</td></tr>
<tr><td>w#cc1</td><td>w#cd1</td></tr>
<tr><td>w#cc2</td><td>w#cd2</td></tr>
<tr><td>w#cc4</td><td>w#cd4</td></tr>
</tbody></table>
Uploaded: w#timestamp

Resulting in this output:

3798

As you can see, the line with the telephon number (w#cc3 and w#cd3) is left out, because the corresponding box is not chekced so it will not display anyway.

The captions as well as the data itsself may be plain text only, without html tags. Any formatting should be done in the description field.

qTranslate shortcodes are supported, e.g.: [:en]Name[:nl]Naam[:fr]Nom[:] can be a Caption, [:en]Yellow[:nl]Geel[:fr]Jaune[:] can be a custom field content, supporting English, Dutch and France languages.

Bulk input of custom data

You can bulk input custom data from a .csv (comma separated values) file.
The file must have the following format:
Line 1 contains a search indicator, either name, photoname or filename followed by the captions of the custom datafields. The case of the characters ( upper -lowercase ) of the search indicator is not important, the captions must exactly meet the existing captions as defined in Advanced settings -> Custom data -> I: Photo custom data fields configuration if they are already defined. If they are not yet defined, they will be created. Note that there is a maximum of 10 fields, supplying more data will fail.

The second and subsequent lines contain the search value and the custom data values that correspond with the captions.

If the search indicator is photoname, all the photos with that name will get the supplied data in the custom data fields.
If the search indicator is filename, the photos will be searched by their filename.
If the search indicator is name, the photos will be searched by their name and filename.

Note that multiple photos can get the same custom data this way.

Example file:

Photoname,Sponsored By,Message,Email,Age,City,Major
Evie Leiby,Gold's Gym,Get well.,evie@xxx.com,6,Buffalo,Math
Khalil Golden,ABC Company,It's going to be ok.,gold@yyy.com,,Fredonia,Electronics
Alaeya Martin,Reeds Gems,Wishing you well.,martina@zzz.org,7,Williamsville,Nursing
Shamari Bolton,Pet Emporium,"Hold on, it will all work out.",,12,Buffalo,Sociology

If you have the csv file ready, ftp it to your depot directory (You can find it on the Photo Albums -> Import Photos admin page usually .../wp-content/wppa-depot/[loginname]/). The file MUST have the extension .csv to be recognized.

After ftp-ing the file, open the Import screen. If there are more files in your depot, you may see the white Start Ajax button adjacent to the blue Import button. Use the Import button, the Ajax button will not work for this operation.

If it takes more time than 30 seconds, the procedure will auto restart. During processing, the datalines of which the corresponding photo(s) is/are found will be removed from the file. If the procedure comes to an end and the file is still there, it will contain the data lines of photos that were not found. The size in kb of the file will be updated every 30 seconds, so you can see the progression. (In my test 10.000 lines were processed within 30 seconds, but it can vary depending on the speed of the database. 2 queries per line are required).

Bulk input of system data

The possible items to import using this procedure has been extended to some system data fields, that may be combined in the same .csv file for the custom data fields.
The folowing fields are importable:

'album',		// bigint(20) NOT NULL,
'name',			// text NOT NULL,
'description',		// longtext NOT NULL,
'p_order',		// smallint(5) NOT NULL,
'linkurl',		// text NOT NULL,
'linktitle',		// text NOT NULL,
'linktarget', 		// tinytext NOT NULL,
'owner', 		// text NOT NULL,
'timestamp', 		// tinytext NOT NULL,
'status', 		// tinytext NOT NULL,
'tags',			// text NOT NULL,
'alt',			// tinytext NOT NULL,
'modified',		// tinytext NOT NULL,
'location',		// tinytext NOT NULL,
'views',		// bigint(20) NOT NULL default '0',
'clicks',		// bigint(20) NOT NULL default '0',
'exifdtm', 		// tinytext NOT NULL,

Make sure the values have the right format! Note that the formats, like // tinytext NOT NULL, as listed above, are for your reference only, do not include them in your .csv file!
The first item on the headerline (the search indicator) MUST be filename when you bulk import system fields.
It simply works now as follows: If a 'system' datafieldname is found in the .csv headerline, it is assumed to be the system data field, else it is assumed to be a custom data field.
There is no way to import a .csv file for album custom fields.