Question Detail

I have multiple links but want to check which one is for ImageURL, How can I validate the link is Image URL?

like this URL is Image URL: https://pbs.twimg.com/profile_images/839844303694356480/vAX6v0LD.jpg and this is normal website URL : https://www.google.co.in/search?safe=active&rlz=1C1CHBF_enIN743IN743&biw=1280&bih=928&q=+site:vbagetech.com+qna+vbage&sa=X&ved=0ahUKEwju3db7ldDXAhUlTY8KHapqD6YQrAMIOQ

I want to test all URL dynamically auto programmatically validate.


Thread Reply

alex levine

- 1 years ago

If your PHP is enabled for remote connections, you can just use

getimagesize('image_URL');

 

<?php 
list($width, $height) = getimagesize("https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQsfoOfje-7r6sF85AsNz5bOaq1pRgcAEqd3cxZNZ8zpSDZ8XK9"); 
$img_arr = array('height' => $height, 'width' => $width );
print_r($img_arr); //output - Array ( [height] => 527 [width] => 800 ) 
?>