WordPress.org

Support

Support » Plugins and Hacks » [Plugin: NextGEN Gallery] Crop thumbnails?

[Plugin: NextGEN Gallery] Crop thumbnails?

Viewing 12 replies - 1 through 12 (of 12 total)
  • Vitali
    Member

    @telobyte

    So I’m looking for “Crop thumbnail to exact dimensions (normally thumbnails are proportional)” check box in NextGEN.
    ( http://codex.wordpress.org/Settings_Media_SubPanel )

    Vitali
    Member

    @telobyte

    anyone?

    Vitali
    Member

    @telobyte

    Ok, temporarily I did it with TimThumb.

    nextgen-gallery/view/gallery.php
    src="http://www.*.ru/wp-content/themes/*/thumb.php?src=<?php echo $image->imageURL ?>&h=100&w=198&zc=1"

    darthmortar
    Member

    @darthmortar

    How did that go?

    Vitali
    Member

    @telobyte

    nextgen-gallery/view/gallery.php

    <!-- Thumbnails -->
    <?php foreach ($images as $image) : ?>
    
    <div id="ngg-image-<?php echo $image->pid ?>" class="ngg-gallery-thumbnail-box" <?php echo $gallery->imagewidth ?> ><div class="ngg-gallery-thumbnail" >
    	<a href="<?php echo $image->imageURL ?>" title="<?php echo $image->description ?>" <?php echo $image->thumbcode ?> ><img title="<?php echo $image->alttext ?>" alt="<?php echo $image->alttext ?>" src="http://www.*.ru/wp-content/themes/*/thumb.php?src=<?php echo $image->imageURL ?>&h=100&w=198&zc=1&q=90" <?php echo $image->size ?> /></a>
    </div></div>
    <?php if ( $gallery->columns > 0 && ++$i % $gallery->columns == 0 ) { ?>
    <br style="clear: both" />
    <?php } ?>
     <?php endforeach; ?>
    <!-- Pagination -->

    Try to use this patch:

    diff -ur ngg-1.4.1-original/admin/css/nggadmin.css ngg-1.4.1-patched/admin/css/nggadmin.css
    --- ngg-1.4.1-original/admin/css/nggadmin.css	2009-11-10 11:23:32.000000000 +0300
    +++ ngg-1.4.1-patched/admin/css/nggadmin.css	2009-11-09 00:03:18.000000000 +0300
    @@ -151,8 +151,6 @@
     }
    
     .fixed .column-thumbnail img{
    -	max-height:60px;
    -	max-width:80px;
     }
    
     .fixed .column-id {
    diff -ur ngg-1.4.1-original/admin/edit-thumbnail.php ngg-1.4.1-patched/admin/edit-thumbnail.php
    --- ngg-1.4.1-original/admin/edit-thumbnail.php	2009-11-10 11:23:32.000000000 +0300
    +++ ngg-1.4.1-patched/admin/edit-thumbnail.php	2009-11-08 23:55:11.000000000 +0300
    @@ -166,7 +166,7 @@
     		jQuery('#imageToEdit').Jcrop({
     			onChange: showPreview,
     			onSelect: showPreview,
    -			aspectRatio: <?php echo round($WidthHtmlPrev/$HeightHtmlPrev,1) ?>
    +			aspectRatio: <?php echo round($WidthHtmlPrev/$HeightHtmlPrev,3) ?>
     		});
     	});
     -->
    diff -ur ngg-1.4.1-original/admin/functions.php ngg-1.4.1-patched/admin/functions.php
    --- ngg-1.4.1-original/admin/functions.php	2009-11-10 11:23:32.000000000 +0300
    +++ ngg-1.4.1-patched/admin/functions.php	2009-11-08 23:53:41.000000000 +0300
    @@ -264,7 +264,9 @@
     		if (!$thumb->error) {
     			if ($ngg->options['thumbfix'])  {
     				// check for portrait format
    -				if ($thumb->currentDimensions['height'] > $thumb->currentDimensions['width']) {
    +				$curTan = $thumb->currentDimensions['width'] / $thumb->currentDimensions['height'];
    +				$thTan = $ngg->options['thumbwidth'] / $ngg->options['thumbheight'];
    +				if ($curTan <= $thTan) {
     					// first resize to the wanted width
     					$thumb->resize($ngg->options['thumbwidth'], 0);
     					// get optimal y startpos

    It fixes thumbnails autocropping.

    Please check it.

    tomboersma
    Member

    @tomboersma

    How to install this patch?

    Vitali
    Member

    @telobyte

    Holix,
    Thank you very much! At last, it works as it should.
    What a pity, i didn’t see this 5 month ago.

    tomboersma,
    Manually.
    There are paths of the files you should patch. Download them to your hard disk, then edit.

    «@@» shows stroke and column to edit, «-» shows what to cut, «+» shows what to add. Everything else leave as is.

    Then upload patched files to your site.
    Don’t forget to make a backup of the old ones.

    mariostella
    Member

    @mariostella

    Thanks It fixed it. I saw that in 1.5.5 NextGen applied the edit-thumbnail.php patch (changed 1 to 3) but that did not make it. I wander why Alex Rabe does not look at this with more attention. It is an issue that has been around for some time now… Hey Al, R U there?

    Thanks for the patched! Fixed it with that.
    Hope this will get in the next version..!

    triggame
    Member

    @triggame

    BEAUTIFUL!!!! Thank you so much for that patch. The irregular cropping was driving me crazy.

    asavant
    Member

    @asavant

    Hi, Can someone PLEASE tell me how to install this patch, what files to place and where or do I just go and delete. All I really need to do is to have the image become cropped at the desired size of 295 x 166 instead of stretched and/or blurred. Just one image. I see the patch works but I have no idea where to begin…Any help?

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘[Plugin: NextGEN Gallery] Crop thumbnails?’ is closed to new replies.