Advanced search  

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Pages: [1]   Go Down

Author Topic: changing filenames  (Read 7464 times)

0 Members and 1 Guest are viewing this topic.

Oasis

  • VIP
  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 252
  • iNSiGNiA
    • Pixnet Gallery
changing filenames
« on: September 25, 2003, 05:08:41 pm »

Hi, is there a way I could make coppermine change the filename when uploading the photo? you see, apache doesn't support chinese character filenames very well, and my users are mostly chinese. if they upload photos with chinese filenames they will probably not show up on most browsers. I saw this other photo album where the uploaded files had their names changed on upload. Is this possible to do?
Logged
Pixnet Gallery: http://www.pixnet.net
iNSiGNiA Weblog: http://www.jayliu.org

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
changing filenames
« Reply #1 on: September 25, 2003, 06:26:38 pm »

have you tried that? I think coppermine already changes the filenames...

GauGau
Logged

Oasis

  • VIP
  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 252
  • iNSiGNiA
    • Pixnet Gallery
changing filenames
« Reply #2 on: September 25, 2003, 08:38:00 pm »

nope... at least it doesn't seem to... the filenames remain chinese, and worst of all the last "g" in .jpg gets removed if they are using xp_publish for uploading. so if for example ABCD is two chinese words(chinese is double byte) and the filename is ABCD001.jpg, it gets uploaded into ABCD001.jp and the thumbnail becomes thumb_ABCD001.jp and normal_ABCD001.jp

What i would like is for the program to rename it to a different name, maybe using the time of upload or something similar.... so that ABCD001.jpg will be uploaded as 12301209.jpg or any filename that doesn't have chinese characters..
Logged
Pixnet Gallery: http://www.pixnet.net
iNSiGNiA Weblog: http://www.jayliu.org

Oasis

  • VIP
  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 252
  • iNSiGNiA
    • Pixnet Gallery
changing filenames
« Reply #3 on: September 25, 2003, 08:40:43 pm »

here is an example of what happens..

http://photo.enctu.org/index.php?cat=10012

the photo doesn't show up unless you have "send URL as UTF-8" disabled. And sometimes it doesn't work even if it is disabled. I think this is a problem with apache, but they don't seem to think it's a bug (they probably don't understand the problem since they're not familiar with chinese) and I don't think they intend on fixing it.

EDIT: oops... the user deleted the file.. here is another one I uploaded myself... It just shows up as a broken picture.
http://photo.enctu.org/thumbnails.php?album=35&page=1
You can see the filename, and the file IS there on the server. It just won't show up on the browser.
Here is the photo view: http://photo.enctu.org/displayimage.php?album=35&pos=9
Logged
Pixnet Gallery: http://www.pixnet.net
iNSiGNiA Weblog: http://www.jayliu.org

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
changing filenames
« Reply #4 on: September 26, 2003, 08:08:25 am »

hm, this'll require some looking into it. I'll keep this on my todo-list; please post here if you find a solution for this problem...

GauGau
Logged

Oasis

  • VIP
  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 252
  • iNSiGNiA
    • Pixnet Gallery
changing filenames
« Reply #5 on: September 26, 2003, 01:00:03 pm »

does this mean that there isn't a way I could edit the code so that it would automatically change the filename on upload?

It's the only workaround I can think of
Logged
Pixnet Gallery: http://www.pixnet.net
iNSiGNiA Weblog: http://www.jayliu.org

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
changing filenames
« Reply #6 on: September 26, 2003, 09:58:33 pm »

of course this is the solution - but that's not that easy: you'll have to make sure that a file with the "renamed name" doesn't already exist. If you're a little familar with PHP I suggest you give it a shot :wink:

GauGau
Logged

Oasis

  • VIP
  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 252
  • iNSiGNiA
    • Pixnet Gallery
changing filenames
« Reply #7 on: September 27, 2003, 04:43:12 am »

OK! It worked, I changed $matches[1] to time() and if it uploads too fast (as in more than one photo a second) and gets an identical name it adds the ~$nr++ just as it did when it got identical filenames.
Logged
Pixnet Gallery: http://www.pixnet.net
iNSiGNiA Weblog: http://www.jayliu.org

Oasis

  • VIP
  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 252
  • iNSiGNiA
    • Pixnet Gallery
changing filenames
« Reply #8 on: September 27, 2003, 05:02:28 am »

Still one tiny problem though..

files with chinese filenames still get the last "g" chopped of their file extensions. They show up fine on the website, so I guess IE realizes they're images, but if they download the pics back to their computers they're gonna have to change the extension before they can open it. Also, I'm not sure if the .jp extension is gonna suit all browsers.

Does anyone know what may be causing this? I looked and relooked at the code and I am getting dizzy but I still can't figure out why
Logged
Pixnet Gallery: http://www.pixnet.net
iNSiGNiA Weblog: http://www.jayliu.org
Pages: [1]   Go Up
 

Page created in 0.018 seconds with 18 queries.