Upload descriptions and pictures Upload descriptions and pictures
 

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Main Menu

Upload descriptions and pictures

Started by coppermineuk, February 24, 2005, 12:40:48 PM

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

coppermineuk

I am hoping to find a method to up load images and their description data to simplify the upload process (perhaps from a text file listing descriptions and filenames). The product is so good I'm sure that this must be possible but I cannot find anything in the FAQs and Documentation.

Can you help?

Joachim Müller

no, such a method doesn't exist; at least I don't know a mod that will accomplish this.

Joachim

coppermineuk

Ok and thanks - At least I know I looked hard enough  ;D

I think that it would be useful feature.

Nibbler

If you give more details of what exactly you want, maybe someone will make a mod. :)

Joachim Müller

I guess coppermineuk is refering to something like a csv file to be ftp-uploaded along with the pics that should then hold the title and description of the text. The batch-add screen is then suppossed to look for this particular text file (which might need a defined name) and add the text contained inside the file to the database. I'm not sure how the correlation between the pic file names and the text entries is suppossed to work though. Another option would be (maybe inside "admin tools") to have a little routine that adds a certain line of text (title and/or description) to a whole bunch of pics/files at once, using the coppermine ui (some thumbs with checkboxes and a <textarea> would be all it takes...
Food for thoughts imo, might be a nice mod or future feature - why not add it to the dev todo list maybe?

Joachim

coppermineuk

Gau Gau was about right,

In my example all of my photos have unique filenames - My digital camera sees to that.

What I was hoping to do is keep an offline register of my photos, their titles, their descriptions etc. in a database or excel file. I could then easily export this to a CSV file containing entries such as ;

Filename,Title,Description
IMG101_1044,My Photo,This is a description of my photo.

If this csv file was uploaded then as part of the batch add process coppermine could check for entries in the CSV file for any photos uploaded and then automatically populate the descriptions.

Does that make sense?  ???
Paul

Joachim Müller

sounds like a good idea to me, I'll movbe this thread from "CPG 1.3 Standalone Support" -> "Upload" to "Feature requests" then and mark as "Valid". You (or anyone else reading this thread) are welcome to post a mod/jack to accomplish what you're requesting. We currently have a feature freeze for the devel version (we're planning to release soon), so this probably won't be done anytime soon by a dev team member.

Joachim

pnear

I accomplish this using IPTC embedded information for description, keywords, etc.  The advantage of this approach is that it's future-proof and accomplishes the same goal that you're alluding to. Instead of the information living in a text file (the format of which may always be different) it lives within the image itself.  This makes maintenance and more importantly portability of the image seamless.  I personally use Adobe photoshop elements to maintain my image library, which has great organization tools and writes info out to IPTC.  Alternatively there are free tools like pixvue or exifer that can maintain this info as well.  Coppermine understands IPTC and support for it appears to be growing in future versions of Coppermine. 

Personally, I'd like to provide users with a tutorial on how to use IPTC including:
- What is IPTC
- What tools can I use to maintain IPTC information
- How does Coppermine use IPTC information

Yes, that is the sound of me volunteering.  Ping me back when you're looking to release 1.4 tutorials and I'll happily write a tutorial.

More pontification on this subject here:
http://www.thenears.com/index.php?p=84

Pete

Joachim Müller

tutorials would be very welcome indeed, even before the release of cpg1.4 ;) The features should be stable (we had a feature freeze), there's only some bugs to be ironed out and then the translation can start.

Joachim

pnear

I'll do what I can based on tutorial templates already posted.  Finding the time might be the issue, but I'll add it to the task list.

Pete

Joachim Müller

you might want to take a look at wink, which I used to create the flashed tutorials.

Joachim

Whisper_MCO

Quote from: pnear on February 26, 2005, 10:51:55 PM
I accomplish this using IPTC embedded information for description, keywords, etc.  The advantage of this approach is that it's future-proof and accomplishes the same goal that you're alluding to. Instead of the information living in a text file (the format of which may always be different) it lives within the image itself.  This makes maintenance and more importantly portability of the image seamless.

Pete

I love the above idea, but still really need the CSV feature. I receive hundreds of photos at a time, with request to post quickly. I can easily create a csv file in 10 minutes or less, but embedding IPTC info in each photo would take hours. (Unless you have a batch program for this? Which uses a CSV import?)

We will shortly be moving the site to Coppermine (as a rush job), and have 4-5 thousand photos with info required to be attached. :(

Joachim Müller

Don't expect coppermine dev team members to come up with the requested hack any time soon, as we're busy fixing bugs for cpg1.4 to have a release soon. If you urgently need the hack, I suggest you code it yourself or you hire someone to code it for you.

Joachim

Dave_Logic

That's a shame...Most of the other Gallery scripts appear to have a "default" decsription, title etc for batch uploads per albulm folder. This seriously cut down a lot time..I need to port over about 15,000 images to CM but will never achieve my goal without this feaure...

Nibbler

#14
OK, this is a pretty simple mod:

include/picmgmt.inc.php

find:

// Test if disk quota exceeded

and add just before it

if ($csv_data = csv_import($filename, $CONFIG['fullpath'] . $filepath)) list($title, $caption) = $csv_data;

and in the end of the file, just before the closing ?> tag add the new function:

function csv_import($fname, $filepath)
{
// adjust these to suit - default value will match -> "filename.jpg","my title","my description"
$csvfile = 'files.csv';
$field_delim = ',';
$text_delim = '"';

if (file_exists($filepath . $csvfile)){
$data = file($filepath . $csvfile);
$csv = array();
foreach ($data as $line){
list($filename, $title, $desc) = explode($field_delim, $line);;
$csv[trim($filename, $text_delim)] = array(trim($title, $text_delim), trim($desc, "$text_delim\x00..\x1F"));
}
if (isset($csv[$fname])) return $csv[$fname];
}
return false;
}


Upload the csv file, by default 'files.csv' in the same directory as your batch add folder, but try not to actually batch add the csv file itself. ;)

The options at the top of the new function should let you read the file correctly if you set the right delimiters, although I only tested it with OpenOffice.org csv files.

Dave_Logic

Quote from: Nibbler on March 09, 2005, 03:33:41 PM
OK, this is a pretty simple mod:

include/picmgmt.inc.php

find:

// Test if disk quota exceeded

and add just before it

if ($csv_data = csv_import($filename, $CONFIG['fullpath'] . $filepath)) list($title, $caption) = $csv_data;

and in the end of the file, just before the closing ?> tag add the new function:

function csv_import($fname, $filepath)
{
// adjust these to suit - default value will match -> "filename.jpg","my title","my description"
$csvfile = 'files.csv';
$field_delim = ',';
$text_delim = '"';

if (file_exists($filepath . $csvfile)){
$data = file($filepath . $csvfile);
$csv = array();
foreach ($data as $line){
list($filename, $title, $desc) = explode($field_delim, $line);;
$csv[trim($filename, $text_delim)] = array(trim($title, $text_delim), trim($desc, "$text_delim\x00..\x1F"));
}
if (isset($csv[$fname])) return $csv[$fname];
}
return false;
}


Upload the csv file, by default 'files.csv' in the same directory as your batch add folder, but try not to actually batch add the csv file itself. ;)

The options at the top of the new function should let you read the file correctly if you set the right delimiters, although I only tested it with OpenOffice.org csv files.

Thanks a many - will try as soon as I get in......what is the format of the CSV??
Imagename, Description ???

Dave_Logic

#16
Quote from: Dave_Logic on March 09, 2005, 06:49:36 PM
Quote from: Nibbler on March 09, 2005, 03:33:41 PM
OK, this is a pretty simple mod:

include/picmgmt.inc.php

find:

// Test if disk quota exceeded

and add just before it

if ($csv_data = csv_import($filename, $CONFIG['fullpath'] . $filepath)) list($title, $caption) = $csv_data;

and in the end of the file, just before the closing ?> tag add the new function:

function csv_import($fname, $filepath)
{
// adjust these to suit - default value will match -> "filename.jpg","my title","my description"
$csvfile = 'files.csv';
$field_delim = ',';
$text_delim = '"';

if (file_exists($filepath . $csvfile)){
$data = file($filepath . $csvfile);
$csv = array();
foreach ($data as $line){
list($filename, $title, $desc) = explode($field_delim, $line);;
$csv[trim($filename, $text_delim)] = array(trim($title, $text_delim), trim($desc, "$text_delim\x00..\x1F"));
}
if (isset($csv[$fname])) return $csv[$fname];
}
return false;
}


Upload the csv file, by default 'files.csv' in the same directory as your batch add folder, but try not to actually batch add the csv file itself. ;)

The options at the top of the new function should let you read the file correctly if you set the right delimiters, although I only tested it with OpenOffice.org csv files.

Thanks a many - will try as soon as I get in......what is the format of the CSV??
Imagename, Description ???

Firstly...Many many thanks - It works perfectly, in fact I'm very surprised just how faultless that was!!!...Maybe I'm pushing my luck but how hard would it be to include the keywords and even possibly the custom fields??? I've tried appending the $keywords and $user 1... 4 to your code but no joy...

EDIT >>>> Spoke too soon..Worked it out...........Many thanks indeed...!!

MerNion

I have altered the function to include keywords as well... if anyone is interested here it is (i hope there aren't any mistakes):

function csv_import($fname, $filepath)
{
// adjust these to suit - default value will match -> "filename.jpg","my title","my description","keyword1 keyword2 etc"
$csvfile = 'files.csv';
$field_delim = ',';
$text_delim = '"';

if (file_exists($filepath . $csvfile)){
$data = file($filepath . $csvfile);
$csv = array();
foreach ($data as $line){
list($filename, $title, $desc, $keywrd) = explode($field_delim, $line);;
$csv[trim($filename, $text_delim)] = array(trim($title, $text_delim), trim($desc, "$text_delim\x00..\x1F"), trim($keywrd, "$text_delim\x00..\x1F"));
}
if (isset($csv[$fname])) return $csv[$fname];
}
return false;
}

rachel75

If anyone is still looking at this thread, I wonder if you might help clarify something for me.
First, I created additional custom fields following these instructions: http://forum.coppermine-gallery.net/index.php?topic=35263.0

Then I added the code in this thread to allow for uploading data along with my images. The title and description upload properly, but none of my custom field data uploads. I have a feeling I am probably making a simple mistake somewhere along the way, but I can't figure it out. The code I used is:
function csv_import($fname, $filepath)
{
// adjust these to suit - default value will match -> "filename.jpg","my title","my description", "my custom fields"
$csvfile = 'files.csv';
$field_delim = ',';
$text_delim = '"';

if (file_exists($filepath . $csvfile)){
$data = file($filepath . $csvfile);
$csv = array();
foreach ($data as $line){
list($filename, $title, $desc, $user1, $user2, $user3, $user4, $user5, $user6, $user7) = explode($field_delim, $line);;
$csv[trim($filename, $text_delim)] = array(trim($title, $text_delim), trim($desc, "$text_delim\x00..\x1F"), trim($user1, "$text_delim\x00..\x1F"), trim($user2, "$text_delim\x00..\x1F"), trim($user3, "$text_delim\x00..\x1F"), trim($user4, "$text_delim\x00..\x1F"), trim($user5, "$text_delim\x00..\x1F"), trim($user6, "$text_delim\x00..\x1F"), trim($user7, "$text_delim\x00..\x1F"));
}
if (isset($csv[$fname])) return $csv[$fname];
}
return false;
}


Any ideas?
Mahalo.

Joachim Müller