Author Topic: Problem with Auto-Thumbnailing Filenames with Spaces  (Read 6629 times)

0 Members and 1 Guest are viewing this topic.

Offline bc

  • Newbie
  • *
  • Posts: 31
    • View Profile
Problem with Auto-Thumbnailing Filenames with Spaces
« on: December 23, 2002, 10:57:04 AM »
I have a problem where NetPBM breaks upon attempting to generate thumbnails for images whose filenames have spaces in them. This happens when I move images to the media/ folder and make 4images detect new images. Once they are succcessfully uploaded, the auto-thumbnail tells me that there was an error creating thumbnail. I know for a fact that it is the filename, because it only happens on files where there are spaces in the filename, and not for singleword or multiple_word (separated by underscore) filenames.

On the other hand, if I manually add images using the "Add Image" feature in the control panel, it automatically replaces spaces with underscores in the filenames while adding, and thus, avoids the problem. I'm thinking that code that does the same for the detect new images would work, but I'm not any good at php coding. Any help?


Here's the error log from Apache:

[error] PHP Warning:  getimagesize: Unable to open './../data/media//' for reading. in c:\program files\apache group\apache\htdocs\gallery\includes\image_utils.php on line 160
c:\netpbm\jpegtopnm.exe: WRITING PPM FILE
c:\netpbm\pnmtojpeg.exe: Architecture.jpg - No such file or directory
c:\netpbm\jpegtopnm.exe: Too many arguments.  The only argument accepted is the input file specificaton
c:\netpbm\pnmscale.exe: Error reading magic number from PBM file.  Most often, this means your input file is empty.


As you can see, the syntax for the pnmtojpeg is incorrect; it should specify "Contemporary Architecture.jpg" as the filename instead of "Architecture.jpg", and that is why the error shows. I will investigate further into the image_utils.php in the includes folder and see what I can do.

Offline bc

  • Newbie
  • *
  • Posts: 31
    • View Profile
Problem with Auto-Thumbnailing Filenames with Spaces
« Reply #1 on: December 23, 2002, 11:09:21 AM »
Yep, I'm code-illiterate. I need someone to help me out here :p

Offline Jan

  • Administrator
  • 4images Guru
  • *****
  • Posts: 5.024
    • View Profile
    • 4images - Image Gallery Management System
Problem with Auto-Thumbnailing Filenames with Spaces
« Reply #2 on: December 23, 2002, 03:21:16 PM »
Rename the images before uploading ;)

Jan
Your first three "must do" before you ask a question:
1. Forum rules
2. FAQ
3. Search

Offline bc

  • Newbie
  • *
  • Posts: 31
    • View Profile
Problem with Auto-Thumbnailing Filenames with Spaces
« Reply #3 on: December 23, 2002, 06:54:34 PM »
UGH! :( I was hoping that there would be a more flexible option within the code, but if that'd be in the next version of 4images, I'd appreciate it.

Offline Chris

  • 4images Moderator
  • 4images Guru
  • *****
  • Posts: 4.487
  • Did u ever stop to think and then forget to start?
    • View Profile
Take note
« Reply #4 on: December 23, 2002, 07:34:42 PM »
As a general rule of thumb it is not a good idea to have spaces in directory or file names for anything to do with a web site.  Spaces can't be easily inserted into a URL.  If you look at any, and I mean ANY, web site from Microsoft, you will not find any spaces in the URLs that appear in your browser address bar.  The reason has to do with the HTTP protocol and URL syntax.  

As such, image file names with embedded spaces cause http to think that you have supplied a two strings instead of one.  The space is interpreted as terminating the file or directory name.  Your best bet is to find a free or shareware batch file renaming tool for renaming your images before adding them to 4images.

(Disclaimer:  I know this isn't a precise explanation but it should suffice to make my point.)

Offline bc

  • Newbie
  • *
  • Posts: 31
    • View Profile
Problem with Auto-Thumbnailing Filenames with Spaces
« Reply #5 on: December 24, 2002, 06:00:55 PM »
I do recognize that there should not be spaces in urls, but I was talking about replacing spaces with underscores in the filesystem management, as is done in the manual image upload.

For now, I'll get a file-renamer program

Offline Chris

  • 4images Moderator
  • 4images Guru
  • *****
  • Posts: 4.487
  • Did u ever stop to think and then forget to start?
    • View Profile
Yeah
« Reply #6 on: December 24, 2002, 06:38:05 PM »
Good point.  I'll pass that along as a feature request.