auto add text to image name

Eudemon

Joined: 2011-06-12
Posts: 6
Posted: Tue, 2011-11-29 23:02

can someone assist me how to do this

when an image is uploaded by a user, it will be named by the same file name
but i want it automatically add text to the file name
for example
"cat.jpg" will be changed to "mysite cat.jpg"

or at least tell me which file to look for
i do know a little programming

thanks

 
stevep11

Joined: 2011-12-15
Posts: 1
Posted: Thu, 2011-12-22 20:45

I have been having the same problem, and I haven't been able to find an answer. Have you found anything in another forum or blog?
-Steve
[url]www.american-chimney.com[/url]

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Thu, 2011-12-15 19:45

modules/itemadd
ItemAddFromServer.inc
ItemAddFromWeb.inc

look to function addItem
$fileName = basename($file);
$title = ($textFields['title']) ? $base : '';

if you use a different method like uploadify look for its itemAdd file

-s
FlashYourWeb and Your Gallery with The E2 XML Media Player for Gallery2

 
Eudemon

Joined: 2011-06-12
Posts: 6
Posted: Fri, 2011-12-30 20:41

sorry for the delay

could't find those exact lines in itemaddfromweb
i actually alrdy found these before but wut i did is

$title = (isset($form['set']['title']) && $form['set']['title']) ? $base : '';
under that add this line
$title = 'mysite.com' + $title;

and these code

if ($getFileName) {
if (!empty($headers['Content-Disposition'])
&& preg_match('/filename="(.*?)"/', $headers['Content-Disposition'], $match)) {
$fileName = 'mysite.com' + $match[1]; <----
} else if (!empty($urlComponents['path'])) {
$fileName = basename($urlComponents['path']);
$fileName = 'mysite.com' + $fileName; <-----
} else {
$fileName = basename($url);
$fileName = 'mysite.com' + $fileName; <------
}

the arrow is just indicate where i made the change

tested, nothing changed