Is it reliable to use GetImageSize() to detect PHP-generated images?
Using GetImageSize() to detect PHP-generated images may not always be reliable as it relies on the image headers to determine the size, which can be manipulated. A more reliable approach is to store the image dimensions when generating the image and then retrieve them when needed.
// Store image dimensions when generating the image
$image = imagecreatefromjpeg('image.jpg');
$width = imagesx($image);
$height = imagesy($image);
// Retrieve image dimensions
echo "Image width: $width, height: $height";