Adopt filename as title on upload Adopt filename as title on upload
 

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

Adopt filename as title on upload

Started by pnear, January 10, 2005, 06:59:45 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

pnear

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

Nibbler

include/picmgmt.inc.php

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

Just after the globals should do the trick.

wbc

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

kegobeer

look in the file for the word global.  "global" is a declaration statement that makes those variables available on a global scope.
Do not send me a private message unless I ask for one.  Make your post public so everyone can benefit.

There are no stupid questions
But there are a LOT of inquisitive idiots

wbc

#4
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 ?

Joachim Müller

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

wbc


wbc

#7
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.

Joachim Müller

I don't understand your question, please re-phrase and use more words - a screenshot might help as well to illustrate your problem.

Joachim

LWAA

hi - is there any way to make this change to image already uploaded?
<i>"I understand everything, except what you're telling me"</i>


LWAA

I found something that shows the filename in an info box under the pic, that will do, thanks.
<i>"I understand everything, except what you're telling me"</i>