Advanced search  

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

Pages: [1]   Go Down

Author Topic: Rename Picture Files  (Read 4835 times)

0 Members and 1 Guest are viewing this topic.

partyshaker

  • Coppermine newbie
  • Offline Offline
  • Posts: 4
Rename Picture Files
« on: February 06, 2004, 04:39:17 pm »

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
« Last Edit: November 21, 2004, 07:04:16 am by GauGau »
Logged

Casper

  • VIP
  • Coppermine addict
  • ***
  • Country: 00
  • Offline Offline
  • Gender: Male
  • Posts: 5231
Rename Picture Files
« Reply #1 on: February 06, 2004, 09:24:14 pm »

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

  • VIP
  • Coppermine addict
  • ***
  • Country: 00
  • Offline Offline
  • Gender: Male
  • Posts: 5231
Rename Picture Files
« Reply #2 on: February 06, 2004, 09:45:07 pm »

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;

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


Change it to this;

Code: [Select]
// 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);

Code: [Select]
'filename_remove' => 'Remove the .jpg ending and replace _ (underscore) with spaces',

Change it to;

Code: [Select]
'filename_remove' => 'Remove spaces'',
Logged
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

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Rename Picture Files
« Reply #3 on: February 06, 2004, 10:58:00 pm »

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

Pasha

  • Coppermine newbie
  • Offline Offline
  • Posts: 7
Re: Rename Picture Files
« Reply #4 on: November 20, 2004, 10:05:38 pm »

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

Pasha

  • Coppermine newbie
  • Offline Offline
  • Posts: 7
Re: Rename Picture Files
« Reply #5 on: November 21, 2004, 01:05:37 am »

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

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Rename Picture Files
« Reply #6 on: November 21, 2004, 07:04:00 am »

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
Logged

Pasha

  • Coppermine newbie
  • Offline Offline
  • Posts: 7
Re: Rename Picture Files
« Reply #7 on: November 21, 2004, 05:30:36 pm »

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

-Pasha.

Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Rename Picture Files
« Reply #8 on: November 22, 2004, 09:15:03 am »

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

Joachim
Logged

Pasha

  • Coppermine newbie
  • Offline Offline
  • Posts: 7
Re: Rename Picture Files
« Reply #9 on: November 22, 2004, 05:57:14 pm »

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.
Logged
Pages: [1]   Go Up
 

Page created in 0.021 seconds with 18 queries.