How to check image corrupt or not using url in php.Is it possible to check in php? I need to check using image url check image corrupt or not.
Use getimagesize() it will return FALSE if file corrupt otherwise if file is ok then it will return array containing file info like mime, height and width etc, try below example
<?php
$fileName = 'image/corruptsample.jpg'; //filepath
if(getimagesize($fileName) === false){
echo "file is corrupted";
}
else{
echo "file is ok";
}
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