file_get_contents bir çok sunucuda kapalı olabilir,
yerine curl kullanmak gerekir, ufak bir araştırmayla bulduğum cevabı biraz düzelttim.

function getImg($url)
{
    $ch = curl_init($url);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
    curl_setopt($ch, CURLOPT_SSLVERSION, 6);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
    $data = curl_exec($ch);
    curl_close($ch);
    return $data;
}

$url = "https://expoupdate.se/wp-content/uploads/2021/09/Universal-Childrens-Day.jpg";
$raw = getImg($url);
$im = imagecreatefromstring($raw);
$width = imagesx($im);
$height = imagesy($im);
echo $width . " x " . $height;