How can I read remote images in binary format and store them in a database. I used the following method, but var_dump is false (output $ contents is: bool (false )). When the remote http address is changed to a local image, var_dump can read data. Please advise, how to solve reading... how to read remote images as binary and then store them in the database.
I used the following method, but var_dump is false (output $ contents is: bool (false )).
When the remote http address is changed to a local image, var_dump can read data.
Please advise on how to read remote images in binary format. Thank you.
$url = "http://....../logo.png"; $handle = fopen($url,"rb"); $contents = fread($handle,filesize($url)); var_dump($contents);
Reply content:
How can I read remote images in binary format and store them in a database.
I used the following method, but var_dump is false (output $ contents is: bool (false )).
When the remote http address is changed to a local image, var_dump can read data.
Please advise on how to read remote images in binary format. Thank you.
$url = "http://....../logo.png"; $handle = fopen($url,"rb"); $contents = fread($handle,filesize($url)); var_dump($contents);
You must first determine whether the remote image is successfully obtained. It is possible that the recipient has blocked you.
This should help you.
CURL upload | download an object
Php. ini does not enable the settings. You need to set the fopen to open the website directly.