Rename Picture Files Rename Picture Files
 

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

Rename Picture Files

Started by partyshaker, February 06, 2004, 04:39:17 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

partyshaker

Hi,

I want to rename the picturefiles on my server.

The Problem: I includes an Mobile Service to send the pictures to an MMS-Phone. It´s works, but only if the filenames has no Spaces like

Picture1.jpg

If the name is picture 1.jpg, it does not work.

Is there any possibility to rename the pictures ?

If you want to have a look - www.PartyShaker.de

Casper

Hi,

The resize pics utility can change the names, within set parameters.  At the moment, it is set to remove '_', and replace it with a space, but a simple mod to the util.php should reverse the process, so you can replace spaces with something else.

I'll have a look at it for you.
It has been a long time now since I did my little bit here, and have done no coding or any other such stuff since. I'm back to being a noob here

Casper

Hi again,

yes, it works, and is easy.  I have altered it to leave the jpg extension, and to remove spaces

Open util.php, find this code;

// REMOVE .JPG AND REPLACE _ WITH [ ]
                $filename = substr($filename, 0, -4);
                $newtitle = str_replace("_", " ", $filename);


Change it to this;

// REMOVE .JPG AND REPLACE _ WITH [ ]
                //$filename = substr($filename, 0, -4);
                $newtitle = str_replace(" ", "", $filename);


Now open lang/your_lang.php, and find this code (note, the words after => will be in your language);

'filename_remove' => 'Remove the .jpg ending and replace _ (underscore) with spaces',

Change it to;

'filename_remove' => 'Remove spaces'',
It has been a long time now since I did my little bit here, and have done no coding or any other such stuff since. I'm back to being a noob here

Joachim Müller

...and to avoid such stuff in the future, never upload files to your server that contain spaces or other problematic characters to your webserver again. If you want to make sure you don't have spaces in filenames in the future, check "Characters forbidden in filenames" in coppermine config and add a list of characters that shouldn't be in filenames in the first place (in fact, there should only be "regular" letters [a-z], numbers [0-9] minus [-] and underscore [_] in any file you upload to a webserver).

GauGau

Pasha

I didn't notice the " ' " character in the folder name while using "Batch Upload". I've uploded those files from my Windows machine and didn't correct all the folder names.
So I have a " ... Pasha's visit ..." folder there. Attempt to delete a picture from this album now gives an MySQL error message:

While executing query "DELETE FROM cpg132_exif WHERE filename='albums/massupload/Bloomington/2002/Pasha's Visit, Feb 18/DVC00412.JPG' LIMIT 1" on 0

mySQL error: You have an error in your SQL syntax.  Check the manual that corresponds to your MySQL server version for the right syntax to use near 's Visit, Feb 18/DVC00412.JPG' LIMIT 1' at line 1

Is there any graceful way to rename the directory along with those links to it in the database? I realise that I made a mistake, and I will certainly try not to repeat it again.

Thank you very much,
Pasha.

Pasha

The solution I suggested (and implemented, since I sometimes get a little impatient) is the following:

Rename the folder, so that it no longer has "bad" characters.
Go to your database for coppermine photo album. Edit table cpg132_pictures, the "filepath" field in particular, so it pointsto the right place.

Not very graceful, but still a solution.

Good luck,  and thank you very much for all your hard work and support,
Pasha Anaschenko.

Joachim Müller

this issue is related to usage of the old cpg1.2 version, afaik it has been ironed out in cpg1.3.
Upgrading to the most recent stable version (cpg1.3.2) is strongly recommended.

Joachim

Pasha

I am using cpg 1.3.2, which means this little  problem is still there.

-Pasha.


Joachim Müller

check your "Characters forbidden in filenames" settings in coppermine config (post them here), please.

Joachim

Pasha

I kept the default setting, since I was not quite sure what that thing was and how it works.
Later (after the "accident") , I think, I added "&" at the end.

Here is what it is now:         $/\\:*?"'<>|`&

Pasha.