• 27-05-2022, 13:42:35
    #1
    Arkadaşlar selam, internet sitemdeki resimlerin a href kodlarına width ve height eklemeye çalışıyorum. Her resim aynı değerlere sahip olmadığı için php ile resmin genişlik ve yüksekliğini nasıl alabilirim?

    <img width="#" height="#" src="https://.....">

    Yukarıdaki "width="#" height="#" kısmına ne eklemeliyim ki php ile otomatik olarak resmin yükseklik ve genişliği gelsin?
  • 27-05-2022, 13:49:31
    #2
    https://www.php.net/manual/tr/function.getimagesize.php

    <?php
    list($width, $height, $type, $attr) = getimagesize("img/flag.jpg");
    echo $width .  ' - ' .  $height;
    ?>
  • 27-05-2022, 13:53:03
    #4
    FSahin adlı üyeden alıntı: mesajı görüntüle
    https://www.php.net/manual/tr/function.getimagesize.php

    <?php
    list($width, $height, $type, $attr) = getimagesize("img/flag.jpg");
    echo $width .  ' - ' .  $height;
    ?>
    Hocam bunu <img width="#" height="#" src="https://....."> linkinde nasıl kullanacağım?
  • 27-05-2022, 13:57:07
    #5
    Misafir adlı üyeden alıntı: mesajı görüntüle
    Hocam bunu <img width="#" height="#" src="https://....."> linkinde nasıl kullanacağım?
        <?php 
            list($width, $height) = getimagesize('https://i.cnnturk.com/i/cnnturk/75/740x416/5fd1c17c5cf3b01fe01c4b27.jpg');
            echo '<img src="https://i.cnnturk.com/i/cnnturk/75/740x416/5fd1c17c5cf3b01fe01c4b27.jpg" width="'.$width.'" height="'.$height.'">';
        ?>