• Resolved zkizzik

    (@zkizzik)


    I have a solution of error in memory limit t use gd in large images:

    admin/functions.php
    replace:

    // save temp file to gallery
    						if ( !@move_uploaded_file($temp_file, $dest_file) ){
    							nggGallery::show_error(__('Error, the file could not be moved to : ','nggallery') . $dest_file);
    							nggAdmin::check_safemode( $gallery->abspath );
    							continue;
    						}

    to:

    // fix error memory with big images
    					if($imagick_t = new Imagick($temp_file)){
    						$imagick_t->thumbnailImage(900, 900, true); /* Resize to 900x900 */
    						$imagick_t->writeImages($dest_file, false); /* rewrite */
    						$imagick_t->clear();
    						$imagick_t->destroy();
    					}else{
    
    						// save temp file to gallery
    						if ( !@move_uploaded_file($temp_file, $dest_file) ){
    							nggGallery::show_error(__('Error, the file could not be moved to : ','nggallery') . $dest_file);
    							nggAdmin::check_safemode( $gallery->abspath );
    							continue;
    						}
    					}

    Replace:

    // save temp file to gallery
    			if ( !@move_uploaded_file($_FILES["Filedata"]['tmp_name'], $dest_file) ){
    				nggAdmin::check_safemode(WINABSPATH.$gallerypath);
    				return __('Error, the file could not be moved to : ','nggallery').$dest_file;
    			}

    to:

    // fix error memory with big images
    		if($imagick_t = new Imagick($_FILES["Filedata"]['tmp_name'])){
    			$imagick_t->thumbnailImage(900, 900, true); /* Resize to 900x900 */
    			$imagick_t->writeImages($dest_file, false); /* rewrite */
    			$imagick_t->clear();
    			$imagick_t->destroy();
    		}else{
    			// save temp file to gallery
    			if ( !@move_uploaded_file($_FILES["Filedata"]['tmp_name'], $dest_file) ){
    				nggAdmin::check_safemode(WINABSPATH.$gallerypath);
    				return __('Error, the file could not be moved to : ','nggallery').$dest_file;
    			}
    		}

    Work! 🙂
    any hosting use imagick in php class.
    my hosting is hostgator, but dont use imagick in binary mode and gd dont work.

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

  • The topic ‘[Plugin: NextGEN Gallery] Solution of memory limit’ is closed to new replies.