Forums

NextGEN Gallery
Width / Height variable for Singlepic? Can't figure it out (4 posts)

  1. remotay
    Member
    Posted 1 year ago #

    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.

  2. remotay
    Member
    Posted 1 year ago #

    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.

  3. remotay
    Member
    Posted 1 year ago #

    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.

  4. madmax1404
    Member
    Posted 1 year ago #

    Hello

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

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.