While uploading this image to the page using the Graph API on Facebook, I am receiving the error
"error_user_title": "Can't Read Files",
"error_user_msg": "Your photos couldn't be uploaded. Photos should be less than 4 MB and saved as JPG, PNG, GIF, TIFF, HEIF, or WebP files."
The provided image is JPEG and also does not exceed the 4MB limitation. However, if I use other JPEG images that are also less than 4MB, then the API successfully uploads the image.
To test, I even used the curl method provided in the documentation
curl -i -X POST \
-d "url=image_url" \
-d "published=false" \
-d "<access-token>" \
"https://graph.facebook.com/me/photos"
Using this code, I can successfully reproduce the error and also test for other images that get uploaded successfully, and I get the image ID returned from Facebook
Both of the images are accessible and are just a few KB in size. Can anyone help me figure out why the first image cannot be uploaded to Facebook?
Additionally, if I create the post directly using the first image in Facebook's page dashboard, it is successfully created.
For anyone facing the same issue or issue related to an image in Facebook's graph API, I fixed it by removing the image's EXIF data using Imagick before the upload.
I opened a bug report they said they found the bug but the fix would only be applied after a few months, which was never applied. They fixed the example image but didn't mention how to fix it by ourselves and I figured the only thing that we could do was remove or manipulate the EXIF data. In my case, the issue was happening when the image was taken from the mobile's Camera mostly from iPhone (forgot which ones) and Motorola.