phpimage-processinguploadcolor-profilecolor-management

PHP move_uploaded_file - image not correct colors? (ICC Profile?)


Image illustrating the problem I have

I am trying to upload photos, but once PHP handles the upload with move_uploaded_file the colors gets all messed up and blue-ish in the color. I have no idea what all these ICC profile (designer stuff) is and all I want is to upload images that look EXACTLY like the ones the customer has in Photoshop.

I was reading about the ICC Profiles and found this

But there are no documentation. In order for me to do this I have to have the original photo and copy the ICC profile, but before I can have the original photo I have to upload it, and in the process it ruins the ICC profile and make the image "blue" - so it's kinda like running in circles for me right now.

Does anyone have a trick for this? I prefer NON-imagemagick solutions, as I am not a fan of being dependant on third-party plugins (server/webhotel issues everytime).

Thanks!


Solution

  • move_uploaded_file() does not alter a single byte of the file, it's just a secure alternative to good old rename() designed for file uploads and it certainly knows nothing about image formats:

    This function checks to ensure that the file designated by filename is a valid upload file (meaning that it was uploaded via PHP's HTTP POST upload mechanism). If the file is valid, it will be moved to the filename given by destination.

    This sort of check is especially important if there is any chance that anything done with uploaded files could reveal their contents to the user, or even to other users on the same system.

    The error must be somewhere else.