coppermine-gallery.com/forum

Support => cpg1.3.x Support => Older/other versions => cpg1.3 Upload => Topic started by: pnear on January 10, 2005, 06:59:45 PM

Title: Adopt filename as title on upload
Post by: pnear on January 10, 2005, 06:59:45 PM
Apologies in advance - this seems like something that would have been asked many times before but my searches were not fruitful.

I would like to adopt the filename as the title of an image if no title has been specified.  I see that this can be done using the admin tools after the fact, but no setting to use this rule on upload.  I swear I'd seen that somewhere before.

Why:  I'm streaming via RSS and by default, most of my images have no titles.  This looks odd in an RSS reader, and I'd like to at least output something.

Any help pointing me to the answer would be appreciated.

Cheers,
Pete
Title: Re: Adopt filename as title on upload
Post by: Nibbler on January 10, 2005, 07:09:28 PM
include/picmgmt.inc.php

$title = $title ? $title : $filename;

Just after the globals should do the trick.
Title: Re: Adopt filename as title on upload
Post by: wbc on January 26, 2005, 12:20:33 PM
Quote from: Nibbler on January 10, 2005, 07:09:28 PM
include/picmgmt.inc.php

$title = $title ? $title : $filename;

Just after the globals should do the trick.

I do'nt understand what you mean by the "glbals". would you please point it out? Thank you
Title: Re: Adopt filename as title on upload
Post by: kegobeer on January 26, 2005, 12:55:34 PM
look in the file for the word global.  "global" is a declaration statement that makes those variables available on a global scope.
Title: Re: Adopt filename as title on upload
Post by: wbc on January 27, 2005, 11:49:00 AM
Hi !
there are two sections related to "alobal":

(1)
// Add a picture to an album
function add_picture($aid, $filepath, $filename, $title = '', $caption = '', $keywords = '', $user1 = '', $user2 = '', $user3 = '', $user4 = '', $category = 0, $raw_ip = '', $hdr_ip = '',$iwidth=0,$iheight=0)
{
   global $CONFIG, $ERROR, $USER_DATA, $PIC_NEED_APPROVAL;
   global $lang_errors;

$title = $title ? $title : $filename;


and  
(2)

* @return 'true' in case of success
*/
function resize_image($src_file, $dest_file, $new_size, $method, $thumb_use)
{
   global $CONFIG, $ERROR;
   global $lang_errors;

$title = $title ? $title : $filename;

   $imginfo = getimagesize($src_file);

and I put  $title = $title ? $title : $filename;  in both sections. Is it correct ?


Great ! It seems work!  How about batch_add files? It also works ?
Title: Re: Adopt filename as title on upload
Post by: Joachim Müller on January 27, 2005, 01:11:15 PM
Quote from: wbc on January 27, 2005, 11:49:00 AM
and I put  $title = $title ? $title : $filename;  in both sections. Is it correct ?
It's probably only needed once, but tt least it won't hurt if it's in there twice.


Quote from: wbc on January 27, 2005, 11:49:00 AMGreat ! It seems work!  How about batch_add files? It also works ?
No, the batch-add is not controlled by upload.php, but by searchnew.php

Joachim
Title: Re: Adopt filename as title on upload
Post by: wbc on January 28, 2005, 01:44:38 AM
so, how to do it for batch_add  ????
Title: Re: Adopt filename as title on upload
Post by: wbc on January 28, 2005, 11:52:39 AM
Great ! It also work for batch_add !


but there is a problem that there are ***.jpg(file type), .jpg  can't be removed !

Can it be removed?
How ?


Thank you.
Title: Re: Adopt filename as title on upload
Post by: Joachim Müller on January 30, 2005, 08:24:41 AM
I don't understand your question, please re-phrase and use more words - a screenshot might help as well to illustrate your problem.

Joachim
Title: Re: Adopt filename as title on upload
Post by: LWAA on September 28, 2005, 12:41:36 PM
hi - is there any way to make this change to image already uploaded?
Title: Re: Adopt filename as title on upload
Post by: Nibbler on September 28, 2005, 12:57:47 PM
Use admin tools.
Title: Re: Adopt filename as title on upload
Post by: LWAA on September 28, 2005, 01:12:00 PM
I found something that shows the filename in an info box under the pic, that will do, thanks.