Support » Plugin: WordPress Gallery Plugin - NextGEN Gallery » Bug report – NextGen Widget Not Working

  • Resolved RoxyJo

    (@roxyjo)


    Hi,
    It seems that the NextGen widget is not working properly.

    I had chosen for the widget to display the original image at a custom size. The widget is still pulling the image from the thumbnails, rather than the original size.

    Also i’ve also specified that i would like the photo randomly pulled from the category i’ve specified, but it seems to be pulling them from all categories.

    http://wordpress.org/plugins/nextgen-gallery/

Viewing 15 replies - 1 through 15 (of 18 total)
  • Same here.
    Version 2.0.7.

    Would love to find a fix.

    The same thing happened to me.

    I reported it here: http://www.nextgen-gallery.com/report-bug/

    (And then I replace NextGen widget with another picture).

    Plugin Contributor photocrati

    (@photocrati)

    Hi all – we’ve tested widgets a lot, and I just tested this again on multiple sites to confirm it’s working. I tested both slideshow and thumbnail widgets, and tested sized adjustments and limiting by gallery. So we need to understand either exactly what you’re trying to get or what maybe happening specific to your instances.

    First, just to confirm: you are all talking about the NextGEN slideshow widget, correct? (not the NextGEN thumbnail widget)

    Second, if you adjust the size to say, 180X270, does the size of the display on your sidebar change to that size?

    Third, @roxyjo, you mentioned that “chosen for the widget to display the original image” but there’s no option we offer for selection to display the original image vs some other source. Also you mentioned “photo randomly pulled from the category” but you’d only be able to choose to display from specific galleries, so I’m wondering if you can clarify on that?


    Any other details you can provide on exactly what’s not working would be helpful.

    Hi photocrati,

    I’m using the Nextgen Widget, not the gallery.
    Here’s the widget settings: http://pbrd.co/16izJQ8

    If you look at the source of the front page, you see that even though the widget is set to show the original picture, it pulls the thumbnail:

    http://pbrd.co/16iAadn

    Hope that helps.

    Hello,

    I had a widget called “NextGEN Widget”

    The settings I used:
    Title: Chefstomaten aka Kristina Svensson
    Show: 1 original images
    random
    Enable IE8 Web Sices
    Width x Height: 180 x 400
    Select: only which are listed
    Gallery ID: 112

    It looked great with NGG 1.9.13 but with NGG 2.0 the original picture was replaces with the thumbnail image (100 x 100). And if you blow up a thumbnail 100 x 100 to 180 x 400 it looks rather horrible.

    I replaced it with bracket a href=”http://www.kristinasvensson.se/om-kristina-svensson/”>
    <img src=”http://www.tomatsallad.nu/nextgen-image/2255/180x0x100/8654279101074f1e8577c1767be14442 </a bracket.

    Thread Starter RoxyJo

    (@roxyjo)

    Yes, those are the exact problems I’m having. In addition, when I specify which gallery I would like the widget to get the photos from, the widget seems to get the photos from all of the Galleries.

    like this:
    http://pbrd.co/14RJOXi

    I’m having exactly the same problem — distorted thumbnails are showing instead of the resized original images that used to show. I’ve tried re-creating the widget, toggling the settings, etc. I went into the database settings for NextGen variables, but it’s not easy to see how the widget UI maps to the database.

    I’m using the Mystique theme, but I’ve done a preview with twentythirteen and the same problem is there. We aren’t using any NG plug-ins.

    Site: http://stargate-sg1-solutions.com/blog/

    Settings: http://stargate-sg1-solutions.com/blog/NGWidgetSettings.png

    This is a bit of the html source that’s rendered — note the source is from thumbs/.

    <li class="block"><div class="block-ngg_images clearfix" id="instance-ngg-images-4"><div class="hslice" id="ngg-webslice"><h3 class="entry-title title"><span>Gallery</span></h3><div class="block-div"></div><div class="block-div-arrow"></div><div class="ngg-widget entry-content">
                <a href="http://stargate-sg1-solutions.com/blog/wp-content/gallery/paul-mcgillion/the-killing.jpg" title="<br /><div align="center"><strong>Andrew Clarke in multiple S3 Starting June 30, 2013</div>"
               data-image-id='313'
               class="shutterset_96675af4225c20b99435ecd58277eb2f"><img title="The Killing" alt="The Killing"
                     src="http://stargate-sg1-solutions.com/blog/wp-content/gallery/paul-mcgillion/thumbs/thumbs_the-killing.jpg"
                     width="260"
                     height="146"
                /></a>

    I found the bug in the widget. Down in the template code, it is hard-coded to use the ‘thumb’ selection instead of the user choice, ‘thumb’ or ‘original’.

    Here is the current code, in wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/widget/templates/display_gallery.php:

    <img title="<?php echo esc_attr($image->alttext)?>"
                     alt="<?php echo esc_attr($image->alttext)?>"
                     src="<?php echo esc_attr($storage->get_image_url($image, 'thumb')); ?>"
                     width="<?php echo esc_attr($settings['image_width']); ?>"
                     height="<?php echo esc_attr($settings['image_height']); ?>"
                />

    Note the hard-coded ‘thumb’. I changed ‘thumb’ to $settings[‘show’], and now my widget looks correct again — it follows my settings. This seems like a bug that would affect all gallery widgets, so I’m not sure how some folks aren’t seeing it!

    @astrumporta, works as charm!

    I was looking at that code, but I didn’t look hard enough to fins that.

    Now the next improvement will be to show a dynamic on the fly thumbnail at a specific size from the original picture (different from the default thumbnails size) so it will look good but still as small as possible in download size.

    I might create an external php code to select randomly the gallery directory and create on-the-fly picture.

    @photocrati I confirm that @astrumporta’s fix did the trick. Please check your code again and integrate this fix in the next version.

    Plugin Contributor photocrati

    (@photocrati)

    @astrumporta: Thanks for taking the time to look at this and for posting the fix. Much appreciated. I’ll forward it to the developers for review and as long as they don’t see any issues, we’ll get it into the next official release. .

    Thanks @astrumporta for the fix, it works!

    @photocrati,

    I’ve made a very nasty workaround to create a right sized picture for the widget.
    What I did, since I have no knowledge of how to create a module for wordpress, I wrote a php snippet which I call from your widget.

    As I said, it’s a nasty hack but if you could make something similar – that would be great. It saves the need to download a full size image and scale it within the browser.

    The code:

    <?php
    /***************************************************************************/
    /* Ugly workaround to display the front small picture better then intended */
    /***************************************************************************/
    
    header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
    header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); // Date in the past
    header("Content-Type: image/jpeg");
    
    $baseDir = '/var/www/html/';					// Base wordpress dirctory
    $cleanDir = '/wp-content/gallery/';				// Make sure no-one is trying to hack us
    $targetWidth = 250;
    $targetHeight = 250;
    
    $path = parse_url($_GET['url'], PHP_URL_PATH);	// Get the path out of the full image location
    $path = str_replace('..', '', $path);			// Remove any .. from the path, to eliminate use of parent dir
    if (strstr($path, $cleanDir)) {					// Making sure path include our hard coded value
    	$filename = $baseDir . $path;
    	if (is_file($filename)) {					// Last check - is it a file?
    		$size = GetImageSize($filename);		// Get the original picture dimentions
    		$originalWidth = $size[0];
    		$originalHeight = $size[1];
    
    		$ratioW = $targetWidth / $originalWidth;	// Check the best way to resize
    		$ratioH = $targetHeight / $originalHeight;
    
    		if ($ratioW < $ratioH)
    			$ratio = $ratioW;
    		  else
    			$ratio = $ratioH;
    
    			$newWidth = $originalWidth * $ratio;	// New dimentions
    			$newHeight = $originalHeight * $ratio;
    
    			$source = ImageCreateFromJPEG($filename);
    			$target = imagecreatetruecolor($newWidth, $newHeight);
    			ImageCopyResized($target, $source, 0, 0, 0, 0, $newWidth, $newHeight, $originalWidth, $originalHeight);
    			imageinterlace($target, true);
    			ImageJpeg($target, NULL, 75);
    			ImageDestroy($target);
    			ImageDestroy($source);
    	}
    }
    ?>

    The call from the original widget, from:
    src="<?php echo esc_attr($storage->get_image_url($image, $settings['show'])); ?>"

    to

    src="/wp-content/additions/createthumb.php?url=<?php echo esc_attr($storage->get_image_url($image, $settings['show'])); ?>"

    I have a similar problem…
    I cannot add more them 363 Images. If I exceed that number I get a white page, without any error messages.
    It does not matter what I change in the settings of the widget, I still get the same result.
    With the previous versions of NG every thing workt, I could have more than 2000 images showing basically unlimited… This function is critical for those of us who want to show the flow of latest images uploaded to a site.
    A little suggestion; Ad a RSS feed to that widget. Every widgets will have a unique RSS feed. Example; Easier for people following a site to follow different categories of images uploaded.

    On to the next problem…
    For now I have to settle with the limitations of the widget.
    With the previous versions of using the widget the result was a nice layouts with proper spacing between the images and white borders and now it is gone… I had to look in the CSS of NG.
    But could not find any CSS for this function I had to fiddle around with some of the other CSS files but without any luck.

    I really hope the NG crew I will fix this as soon as humanly possible

    PS I did not seem to have any problems with image resizing.

    Plugin Contributor photocrati

    (@photocrati)

    Hey all – just and update that one of our developers has resolved this. We’ll aim to push out an informal release with this fix (and others) tomorrow (Thursday) on our latest beta page. It should be in any version 2.0.13 or later.

    http://www.nextgen-gallery.com/nextgen-gallery-latest-beta

Viewing 15 replies - 1 through 15 (of 18 total)
  • The topic ‘Bug report – NextGen Widget Not Working’ is closed to new replies.