• Resolved Max

    (@cobaltmg)


    Hi,
    Upon opening the crop thumbnail editor on a specific image, I get the following error:
    Fatal error: Maximum function nesting level of '100' reached, aborting! in *my-directory*\wp-content\plugins\crop-thumbnails\functions\editor.php on line 466.
    When I try cropping any other image, this problem doesn’t appear.
    Is it possible this is caused by an error in the database?
    I’m using this plugin together with CPT Bootstrap Carousel. In the code of that plugin I registered a new cropped image size.
    I tried re-enabling and re-installing your plugin and re-uploading the images.
    Any idea what might cause this?

    https://www.ads-software.com/plugins/crop-thumbnails/

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Volkmar Kantor

    (@volkmar-kantor)

    Hi max, thanks for letting me know about this. I will have a eye on it.

    Sorry for the late response – i am quite busy.

    Plugin Author Volkmar Kantor

    (@volkmar-kantor)

    Ok, i had a quick look. It seems that you found a serious problem that should have nothing to do with CPT Bootstrap Carousel.

    This may be a problem with a specific image-size / image-resolution.

    Are you so kind to help me fix this?
    Please do the following:
    – go to Settings->Crop-Thumbnails
    – enable “Data-Debug” (on the bottom of the page) and save
    – open the image you had problems with, in the crop-thumbnails-lightbox
    – click on “show debug”, copy the debug
    – post the debug here

    Thanks

    Thread Starter Max

    (@cobaltmg)

    Meanwhile I installed another plugin to still get the functionality.
    But I want to help so I re-installed yours.

    I cannot reach the debug function. When clicking ‘crop thumbnail’ in the media library the crop-thumbnails-lightbox pops up, but only shows the PHP error I posted. (Just like any other PHP error, nothing in the page gets loaded when one thing goes wrong.)

    I can however give you the image-size. It’s quite a large .jpg image.
    1499px in width and 1000px in height. (File size 115 kB.)

    The other ones I tested had the same height, but one had a width of 1913px and the other a width of 1483px.

    Plugin Author Volkmar Kantor

    (@volkmar-kantor)

    hi, thanks a lot.

    that helped. But i need a extra information, what are the sizes post-thumbnails (the “target” sizes you added with add_image_size)?

    Thread Starter Max

    (@cobaltmg)

    Width: 1200px,
    Height: 500px,
    Crop: true.

    Plugin Author Volkmar Kantor

    (@volkmar-kantor)

    Thanks a lot max

    Plugin Author Volkmar Kantor

    (@volkmar-kantor)

    Hi max,
    even if do not want to use the plugin, i have checked the bug. So maybe it helps another user.

    The error is thrown by my “greatest common divisor” function. This function works recursive (call itself until it gets the solution). For the resolution of that image it had to call more than 300 times. That is a very height number, normally you are between 30 and 90.

    Anyways i assume the error is detected by a php-extension called xdebug. XDebug trying to protect you from code that has an “infinite recursion”.
    So a quick-fix will be to set the max-nesting-level higher.

    ini_set('xdebug.max_nesting_level', 400);

    In the next version the plugin will also use the function gmp_gcd (if the php-extension is activated).

    Here is the code to use gmp_gcd instantly. Go to editor (near line 466) replace the function gcd with:

    /**
     * Greatest cummon divisor
     */
    function gcd($a, $b) {
    	if(function_exists('gmp_gcd')) {
    		$gcd = gmp_strval(gmp_gcd($a,$b));
    		$this->addDebug("gcd-version", "gmp_gcd:".$gcd);
    		return ($gcd);
    	} else {
    		$gcd = $this->my_gcd($a,$b);
    		$this->addDebug("gcd-version", "my_gcd:".$gcd);
    		return $gcd;
    	}
    }
    
    function my_gcd($a, $b) {
    	$b = ( $a == 0 )? 0 : $b;
    	return ( $a % $b )? $this->my_gcd($b, abs($a - $b)) : $b;
    }

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Error when trying to crop a certain image’ is closed to new replies.