WordPress.org

Ready to get started?Download WordPress

Forums

[Plugin: NextGEN Gallery] Crop thumbnails? (13 posts)

  1. Vitali
    Member
    Posted 4 years ago #

    Hi,

    Is there such thing as cropping thumbnails ignoring the aspect ratio like TimThumb?
    For example I have an image with dimensions 3000x2000 so thumbnail will be 150x100, but i need 200x100 (not deformed, but cropped).

    Example images:
    http://img205.imageshack.us/img205/5687/20091012160430.gif

    Cropped by WordPress gallery:
    http://img399.imageshack.us/img399/7872/20091012170406.png

    Deformed by NextGEN gallery:
    http://img399.imageshack.us/img399/4876/20091012170417.png

    Excuse me for bad english.

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

  2. Vitali
    Member
    Posted 4 years ago #

    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 )

  3. Vitali
    Member
    Posted 4 years ago #

    anyone?

  4. Vitali
    Member
    Posted 4 years ago #

    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"

  5. darthmortar
    Member
    Posted 4 years ago #

    How did that go?

  6. Vitali
    Member
    Posted 4 years ago #

    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 -->
  7. Holix
    Member
    Posted 4 years ago #

    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.

  8. tomboersma
    Member
    Posted 4 years ago #

    How to install this patch?

  9. Vitali
    Member
    Posted 4 years ago #

    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.

  10. mariostella
    Member
    Posted 3 years ago #

    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?

  11. Silvan
    Member
    Posted 3 years ago #

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

  12. triggame
    Member
    Posted 3 years ago #

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

  13. asavant
    Member
    Posted 3 years ago #

    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?

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.