• Resolved terax

    (@terax)


    Hello,

    i installed Nextgen Gallery before some days and is it working wonderfull.
    But i miss one important function.

    After the picture upload the gallery create the database entries and then it check, if the pictures must be resized and after that it create the thumbnails.

    You can see this in the functions.php in line 200 – 212 (and line 1000 – 1014)

    // add images to database
    		$image_ids = nggAdmin::add_Images($gallery_id, $new_images);
    
    		//add the preview image if needed
    		nggAdmin::set_gallery_preview ( $gallery_id );
    
    		// now create thumbnails
    		nggAdmin::do_ajax_operation( 'create_thumbnail' , $image_ids, __('Create new thumbnails','nggallery') );
    
    		//TODO:Message will not shown, because AJAX routine require more time, message should be passed to AJAX
    		nggGallery::show_message( $created_msg . count($image_ids) .__(' picture(s) successfully added','nggallery') );
    
    		return;

    After adding the follow line

    // now create watermark - Added by D. Herberg 14.03.2011
    		nggAdmin::do_ajax_operation( 'set_watermark' , $image_ids, __('Set watermark','nggallery') );
    // add images to database
    		$image_ids = nggAdmin::add_Images($gallery_id, $new_images);
    
    		//add the preview image if needed
    		nggAdmin::set_gallery_preview ( $gallery_id );
    
    		// now create watermark - Added by D. Herberg 14.03.2011
    		nggAdmin::do_ajax_operation( 'set_watermark' , $image_ids, __('Set watermark','nggallery') );
    
    		// now create thumbnails
    		nggAdmin::do_ajax_operation( 'create_thumbnail' , $image_ids, __('Create new thumbnails','nggallery') );
    
    		//TODO:Message will not shown, because AJAX routine require more time, message should be passed to AJAX
    		nggGallery::show_message( $created_msg . count($image_ids) .__(' picture(s) successfully added','nggallery') );
    
    		return;

    i have the problem, that after an upload the system create the thumbnails and say “xxx pictures successfully added […]”

    If i change the code to the following:

    // add images to database
    		$image_ids = nggAdmin::add_Images($gallery_id, $new_images);
    
    		//add the preview image if needed
    		nggAdmin::set_gallery_preview ( $gallery_id );
    
    		// now create thumbnails
    		nggAdmin::do_ajax_operation( 'create_thumbnail' , $image_ids, __('Create new thumbnails','nggallery') );
    
    		// now create watermark - Added by D. Herberg 14.03.2011
    		nggAdmin::do_ajax_operation( 'set_watermark' , $image_ids, __('Set watermark','nggallery') );
    
    		//TODO:Message will not shown, because AJAX routine require more time, message should be passed to AJAX
    		nggGallery::show_message( $created_msg . count($image_ids) .__(' picture(s) successfully added','nggallery') );
    
    		return;

    I upload some pictures, then nextgen add the pictures to the database, create the watermarking but then it doesn’t create the tumbnails.
    I i open the album / gallery I didn’t see the tumbails. I can click on it and the original picture with the watermark is opening.

    Does anybody know, what I do wrong?

    Best Regards,
    Daniel

Viewing 5 replies - 1 through 5 (of 5 total)
  • You cannot add a second do_ajax_operation() instance. the do_ajax_operation() add a jquery script function, which perfom step by step for each image a defined task.

    Simple solution : look into ajax.php line 37 :

    case 'create_thumbnail' :
    $result = nggAdmin::create_thumbnail($picture);

    add here the wanted function

    case 'create_thumbnail' :
    nggAdmin::set_watermark($picture);
    $result = nggAdmin::create_thumbnail($picture);

    Please note that this change add always a watermark when you create new thumbnails… so you can as well create your own case

    Thread Starter terax

    (@terax)

    Hey Alex,

    thank you for your answer.

    If I change the ajax.php like your sample, then the watermark is only on the thumbnail or is it on the original picture too? ( I need both).

    Best Regards
    Daniel

    Thread Starter terax

    (@terax)

    Hi again,

    sorry yesterday in the evening i didn’t test it.
    But now i changed the ajax.php and is it working fine!

    Normally i didn’t must rebuild the thumbnails so i hope that function is working fine.

    Thank you Alex for your wonderful project.
    A donation is now on your paypal account 🙂

    Greetings
    Daniel

    Hi Alex, great and simple solution, but… i do have a hard one for you:

    – i need to auto create the watermark, but only on the medium size image.

    i´m uploading a big hd image, the gallery creates 2 more images and saves the big one as .jpg_backup. At the end i have 1hd image, 1 medium image of about 500px wide, and a thumbnail of about 150px wide. I need the 500px wide image to have the watermark, but not the 150px wide image.

    can this be done? how?

    Thanks!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘[Plugin: NextGEN Gallery] Adding Auto-Watermark function’ is closed to new replies.