I've been trying to get the size of an image from a url, but it's not working. Can anyone help me?
This is the code:
$imagesize = getimagesize('https://www.dropbox.com/s/hbtmge2omlyqx2n/BrownBag.jpg?dl=0');
echo $imagesize;
You're not getting the image https://www.dropbox.com/s/hbtmge2omlyqx2n/BrownBag.jpg?dl=0 in this url
What you need to get is the image address which is this https://photos-5.dropbox.com/t/2/AADa4bq7fis50BvRTojhB5zvAJDLNwsLDb5dekkb4JfilQ/12/502094097/jpeg/32x32/3/1513760400/0/2/BrownBag.jpg/EJrFv4kEGLgCIAIoAg/cwCCXcZopeYId4BrstNKJ6qGETjrin47oEgU6B50AE0?dl=0&size=1280x960&size_mode=3
Code
$imagesize = getimagesize('https://photos-5.dropbox.com/t/2/AADa4bq7fis50BvRTojhB5zvAJDLNwsLDb5dekkb4JfilQ/12/502094097/jpeg/32x32/3/1513760400/0/2/BrownBag.jpg/EJrFv4kEGLgCIAIoAg/cwCCXcZopeYId4BrstNKJ6qGETjrin47oEgU6B50AE0?dl=0&size=1280x960&size_mode=3');
print_r($imagesize);
Result
Array
(
[0] => 1000
[1] => 750
[2] => 2
[3] => width="1000" height="750"
[bits] => 8
[channels] => 3
[mime] => image/jpeg
)
You can also refer to this Dropbox get public url of the file after upload
Simply change:
https://www.dropbox.com/s/hbtmge2omlyqx2n/BrownBag.jpg?dl=0
to
https://dl.dropbox.com/s/hbtmge2omlyqx2n/BrownBag.jpg
Just replace www
with dl
and remove ?dl=0
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With