Longer Photo Captions


By default indexhibit's photo captions are too small for professional standard captions. There is simply no way you can include the who, what, when, where and why in it's default 35 charactors.

This hack opens removes that restriction

This hack is rewritten from the following indexhibit forum: http://www.indexhibit.org/forum/thread/5445/
with big thanks to LeslieOA.


MySQL database edits

Log into your Indexhibit installations MySQL database (e.g. phpMyAdmin).

Open the table 'ndxz_media'.
You'll need to edit the type values for 'media_title' and 'media_caption'.

By default, 'media_title' is 'varchar(255)' and 'media_caption' is 'tinytext'.
Change them both to 'LONGTEXT'.

Save your changes.

Indexhibit configuration files

Now, log into your FTP (or local LAMP/MAMP/WAMP server).

Open '/ndxz-studio/module/exhibits/index.php' with your favourite text/code editor.

Comment (add // to the beginning of each line) out/remove lines 507, 508, 509 and 510 which should look like this:

$body .= ips($this->lang->word('image title'), 'input', 'media_title', 
    $rs['media_title'], "id='media_title' maxlength='35'", 'text');
$body .= ips($this->lang->word('image caption'), 'input', 'media_caption', 
    $rs['media_caption'], "id='media_caption' maxlength='35'", 'text');

and replace with the following:

$body .= ips($this->lang->word('image title'), 'input', 'media_title', $rs['media_title'], "id='media_title' maxlength='2048'", 'text');
$body .= "<label>Image Caption</label>";
$body .= "<textarea name='media_caption' id='media_caption'>" . $rs['media_caption'] . "</textarea>";

Save and upload your changes.

Edit Indexhibit configs 'ndxz.exhibit-edit.js'

Now open '/ndxz-studio/asset/js/ndxz.exhibit-edit.js'.
Change line 48 which should look like this:

var title = encodeURIComponent( $('input#media_caption').val() );

to the following

var caption = encodeURIComponent( $('textarea#media_caption').val() );

Save and upload your change.

Edit Indexhibit configs 'style.css'

This last step is only cosmetic (for those of you who can manually resize your textareas, you can stop here).

Open '/ndxz-studio/asset/css/style.css' and add the following CSS styles to the bottom of this file: -

#media_title, #media_caption { width: 500px; }
#media_caption { height: 200px;}

Save and upload your changes.

You should now have a longer captions.

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License