≡ Menu

Copying Filename to Title on Coppermine Batch Upload

When you batch add pictures to Coppermine photo gallery you have to manually add the titles to each picture (using the “edit files” option for particular albums). File titles are important in terms of search engine friendliness. Adding titles manually could be a time consuming task if you add large amount of images, here I will walk you through how automatically copy filenames into the Title field on batch add files ( file uploads) to your Coppermine photo gallery.

1. Find the picmgmt.inc.php

picmgmt.inc.php is located in include folder of your Coppermine installation (include/picmgmt.inc.php) directory. Make sure to backup this file before making any below changes.

2. Edit and add new code

Find the code $CURRENT_PIC_DATA[‘title’] = $title; in “include/picmgmt.inc.php” and comment it like this.

Old code

//$CURRENT_PIC_DATA[‘title’] = $title;

Add the following 3 line code below “$CURRENT_PIC_DATA[‘title’] = $title;” which automatically copy filename into title field. This code will also replace underscore (_) with space and remove .jpg from the filename when it’s copied to title field.

New code will look like this

//$CURRENT_PIC_DATA[‘title’] = $title;
$newfilename = substr($filename, 0, -4);
$newtitle = str_replace(“_”, ” “, $newfilename);
$CURRENT_PIC_DATA[‘title’] = $newtitle;

3. Save the file and Try adding new images

After saving the file the above 3 line code snippet, you should be able see the filename in title field when you upload images through batch add files functionality of your Coppermine Gallery.

{ 0 comments… add one }

Leave a Comment