Upload Problem - JPEG files converted and corrupt Upload Problem - JPEG files converted and corrupt
 

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]

Main Menu

Upload Problem - JPEG files converted and corrupt

Started by simpan, September 11, 2004, 04:57:24 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

simpan

I posted a topic a couple of weeks ago having problem uploading pictures. Have been looking into this problem in more depth now and might have enough information for you all to help me troubleshooting this...

Running self-hosted linux RH9 server with
- Apache
- MySql
- PHP
- ImageMagic

Problem
- Coppermine is up and running but I cannot upload pictures in the MySql database.
- What happens is that if I upload a small jpeg file onto the server it states that the
   file has been uploaded and I can normally see the file directly under the userpics/
   folder with proper file permissions.
- In the next step when the file is going to be converted into a thumbnail (which fails)
   and then inserted into the DB i receive the following error "The previous file could
   not be placed"
- In debug mode I receive an error from the db_input.php line 262, i.e. the
   getimagesize(...) function
- A closer look at the uploaded jpeg file shows that it has increased in size (+80kB),
   convert / identify utility does not identify the file as jpeg anymore. Analysing the file
   with hexdump shows that php / coppermine have been adding data to the file.
- Is it this modification of the uploaded file that causes getimagesize() function to fail
   as the ImageMagic utilities no longer recognizes the file format? Is it normal for the
   uploaded file to be modified and increase in size?


Any help is appreciated.

/Simpan

Nibbler

The original uploaded file should not be altered in any way by coppermine. Perhaps the thumbnail is being appended to the original for some reason. Have you tried using GD instead ?

simpan

Could possible try GD instead but it is currently not installed on my system...

Do you have any knowledge to the php / coppermine core function that handles and especially the one that stores the uploaded file? Maybe I should have a look to what is acutally happening in the upload process?

/Simpan

kegobeer

You can look at the upload process in picmgmt.inc.php.  Coppermine doesn't do anything out of the ordinary when using ImageMagick.  It sounds like a problem with ImageMagick, but I'm not sure what.  You could try downloading the newest version and recompiling it to see if it helps.
Do not send me a private message unless I ask for one.  Make your post public so everyone can benefit.

There are no stupid questions
But there are a LOT of inquisitive idiots

simpan

Installed ImageMagic 6.0.7 today and this did not help.

Have just tried GD 1.8.4
- gd-*.rpm
- gd-devel*.rpm
- gd-progs*.rpm

When uploading I receive the error message "not a GD extension" when trying to upload a jpeg file. This of course means that the file was not uploaded at all. This is a small jpeg file that if not uploaded looks ok to the ImageMagic convert utility.

This is odd!?

/Simpan

kegobeer

First off, you should use 2.0.28 - get it at www.boutell.com/gd.  Compile it with JPG, PNG, WBMP, and GIF support.

Unfortunately, I don't have a lot of experience with Linux and compiling modules.  For that kind of specific help, your best bet is to use Google to find some how-to guides.  There's also stuff you have to do to PHP when you add GD.
Do not send me a private message unless I ask for one.  Make your post public so everyone can benefit.

There are no stupid questions
But there are a LOT of inquisitive idiots

simpan

#6
I finally found the problem to the strange errors I had when uploading files to the coppermine DB!

I believe this problem applies to anyone who has used pre-compiled php horde rpms or used the RH9 php rpms...

1. Before I was running on a RH9 linux server where I had installed horde (web e-mail, calendar, etc) and php using rpms not included in the original redhat distribution. They had the same version number but had been compiled and modified for horde.

2. Found out that my horde attachements were corrupt as well, i.e. not only coppermine. This lead me to believe that it was something wrong with part of my php files.

3. Removed all of the horde php rpms and libmcrypt libriaries.

4. Installed the RH9 php distribution rpms

5. Still problems with horde attachements and coppermine uploads!

6. Went for later php rpms but this required a lot of other upgrades as well due to dependencies with other installed modules

7. Upgraded my system to Fedora 2 and uploads worked out of the box :D

My conclusion is that either the php-horde*.rpm corrupted php and a re-install of RH9 php-*-4.2.2-17.i386.rpm did not help
   or
There was a problem with uploads for this specific release of php

Note that if you upgrade from RH9 to FC2 and have the wu-imap server installed (now obsolete) it is swapped for cyrus-imap which is not directly compatible with old imap folders in the users directories. Uninstall cyrus-imap and install dovecot (imap) instead

Hope this is to some help for someone with a similar configuration as mine


/Simpan