class.upload.php is a powerful and mature PHP class to manage uploaded files, and manipulate images in many ways. The script is available under a GPL license.
Firstly, Hi Colin and thanks for a great class. I am currently evaluating it and likely will be soon purchasing a commercial license. Also, I too am in Australia and used to live in Cambridge (and spend a lot of time at the Arts Cinema). Small world n'est-ce pas?
So anyway, 'evaluation' at this point means running a load of test scenarios with input files provided by my client. All of these have gone beautifully, except for one case where a PNG file isn't converting correctly to Jpeg, that is it converts and saves OK, but half the (new) image background is white as I've set, and the other half is black.
I assume this is because of PNG's multiple transparency layers, and your class is only converting one of them? Have you or anyone else come across this before and is there any way around it?
Could you send me this PNG file, or send me a link to it? What did you use to create the PNG picture?
Your assumption about the multiple transparency layers can be right; in fact, I am not sure that GD can even deal properly with these.
I use this image to test with transparent PNGs. I never manage to have all the tests working fine with it, but I make sure that the resulting images are as good as possible.
Assuming that your forum will let me insert links here are two of my test files, one which works (600kb), and one which doesn't' (292kb). They are both as supplied to me, not sure what was used to create them.
The one which works is converted to a Jpeg with a white background to replace the transparency layer (as I've set). The one which doesn't work so well is converted to a Jpeg with the top left part of the previously-transparent background in white as set, and the bottom right part of the previously-transparent background in black (default I think).
From a bit of Googling, it seems that GD should support PNG since version 1.6. I can't find too much about multiple transparency, but will run some of the test files from the pngsuite you link to later.
I tried with both your pictures, and ran some tests, but could not replicate the problem you describe.
I don't see any differences between the two images. They both are PNG, True Color, depth 24, etc... Only the flower_carpet_logo image seems to come from MS Office for some reason.
What version of PHP and GD are you running? Maybe you can try to increase the memory for PHP, in php.ini
Could you also paste here the logs for each of your images? (echo $foo->log after processing)Reply
So anyway, 'evaluation' at this point means running a load of test scenarios with input files provided by my client. All of these have gone beautifully, except for one case where a PNG file isn't converting correctly to Jpeg, that is it converts and saves OK, but half the (new) image background is white as I've set, and the other half is black.
I assume this is because of PNG's multiple transparency layers, and your class is only converting one of them? Have you or anyone else come across this before and is there any way around it?
TIA :)
Could you send me this PNG file, or send me a link to it? What did you use to create the PNG picture?
Your assumption about the multiple transparency layers can be right; in fact, I am not sure that GD can even deal properly with these.
I use this image to test with transparent PNGs. I never manage to have all the tests working fine with it, but I make sure that the resulting images are as good as possible.
Some useful resources here and here.
The one which works is converted to a Jpeg with a white background to replace the transparency layer (as I've set). The one which doesn't work so well is converted to a Jpeg with the top left part of the previously-transparent background in white as set, and the bottom right part of the previously-transparent background in black (default I think).
From a bit of Googling, it seems that GD should support PNG since version 1.6. I can't find too much about multiple transparency, but will run some of the test files from the pngsuite you link to later.
Many thanks for your help.
I don't see any differences between the two images. They both are PNG, True Color, depth 24, etc... Only the flower_carpet_logo image seems to come from MS Office for some reason.
What version of PHP and GD are you running? Maybe you can try to increase the memory for PHP, in php.ini
Could you also paste here the logs for each of your images? (echo $foo->log after processing)