Click to See Complete Forum and Search --> : Can see the problem with these pics?
gokou
05-29-2003, 10:25 PM
I'm not sure if this should go in graphics or php, but the script uploading the pictures is php.
The problem is, when I upload the pictures, they are messed up. I'm not sure what's the problem. Someone said it has to do with permissions, but that doesn't make sense. It sounds like it has something to do with the way php is uploading the pics, but I don't know how to fix it.
Heres a url:
http://24.31.36.232/coppermine/index.php
<snip from http://www.chezgreg.net/coppermine/>
The script use PHP, a MySQL database and the GD library (version 1.x or 2.x) or ImageMagick to make the thumbnails. An install script makes the installation very fast and easy.
</snip>
My guess is that it is a problem with the GD library. I've never used it, but I have heard of this problem...
DaiWelsh
05-30-2003, 12:07 AM
Most likely causes I can think of are file truncation, uploading in ascii as opposed to binary mode between windoze and unix platforms or opening the file to write as text not binary.
Since the sizes vary I am guessing one of the latter, but how this is happening I dont know without knowing more about the code used.
To explain a little more, when you FTP (probably does not apply if the images use HTTP upload) you can set ascii or binary mode. binary mode takes an exact byte for byte copy of the file from A to B, while ascii attempts to convert certain characters that may be different on the two platforms, e.g. windows machines usually use CR/LF to terminate lines in text files, whereas unix systems usually use one character, either LF or 0x06. If you transfer a binary file such as an image in ascii mode, some of the content will undergo this 'translation' which will corrupt it.
Opening a file in text mode as opposed to binary mode when creating it does something vaguely similar in that the O/S will not be expecting binary data to be written to the file and may corrupt it as a result.
Regards,
Dai
gokou
05-30-2003, 05:31 PM
Do you know of a good gd library I can download for php 4.3.1? I downloaded it, but obviously something is still wrong.
I don't know how to change to binary, I do if i'm using a good ftp, but it's just a php script that uploads pictures.
Cactus Hugger
05-31-2003, 06:38 PM
GD comes with the latest version of PHP.
Make sure that the extension_dir is set to the location of the gd extension in the php.ini file, and that the extension is not commented.
DaiWelsh made a good point. Make sure the script works in binary. I'm not sure exactly how that script works, I've never done file transfers, but perhaps look for an fopen(); and check that mode is "rb" or "wb" or has a b in it. (b for binary.)