• I need the width / height variable for singlepic. I’m basically trying to add the Width= height= to the image code for optimizing site speed.

    I opened up singlepic.php and edited it very slightly

    <img class="<?php echo $image->classname ?>" src="<?php echo $image->thumbnailURL ?>" width="<?php echo $width ?>" height="<?php echo $height ?>" alt="<?php echo $image->alttext ?>" title="<?php echo $image->alttext ?>" />

    I just added width=”<?php echo $width ?>” and height=”<?php echo $height ?>” but it’s not working. It’s not pulling the width / height variables. I know this is the right file, as it now shows width=”” height=”” in my code (These weren’t here before). I tried $w and $h as well, but same results.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter remotay

    (@remotay)

    I know very little codiing, but after some googling I have a weird solution, can someone take a quick look at this, and let me know if it’ll cause any problems in the future?

    <?php
    list($width, $height) = getimagesize("$image->thumbnailURL");
    ?>

    ^ I added that bit to make the $height and $width valid.

    <a href="<?php echo $image->imageURL ?>" title="<?php echo $image->linktitle ?>" <?php echo $image->thumbcode ?> >
    	<img class="<?php echo $image->classname ?>" src="<?php echo $image->thumbnailURL ?>" width="<?php echo $width ?>" height="<?php echo $height ?>" alt="<?php echo $image->alttext ?>" title="<?php echo $image->alttext ?>" />
    </a>

    This adds Width and Height tag to thumbnails for singlepic, makes loading times faster :). Just curious if my little hack can cause issues, but it seems like its working.

    Thread Starter remotay

    (@remotay)

    This didn’t work. It causes issues in IE for some reason. Worked fine in Chrome / Firefox though. If anyone has any insight, do let me know.

    I really want my singlepics to show width / height.

    Hello

    I try to establish the same. Did you found a solution?

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[Plugin: NextGEN Gallery] Width / Height variable for Singlepic? Can't figure it out’ is closed to new replies.