Support » Plugin: NextGEN Download Gallery » Linking to HR images (again)

  • Resolved Jon Humphrey

    (@jonrandahl)


    Ross,

    First, Thank you! You’ve made my life so much easier!
    Second, Here’s a little javascript I’ve updated and thought it might help others:

    $("#ngg-download-frm").submit(function(event) {
    		if ($("input[name='pid[]']:checked", this).length == 0) {
    			event.preventDefault();
    			alert("Please select one or more images to download.");
    		}
    	})
    	.on('click','input[type="checkbox"]',function(c){
    		$(c.target).parents('figure').find('img').toggleClass("selectedDownload");
    	})
    	.on('click','a',function(a){
    		a.preventDefault();
    		$(a.target).parents('figure').find('input[type="checkbox"]').click();
    	});
    
    	var $selected = 0;
    
    	$("input.ngg-download-selectall").show().click(function() {
    		if ($selected == 0) {
    			$(this.form).find("input[name='pid[]']").prop({checked: true});
    			$(this.form).find('img').addClass("selectedDownload");
    			$(this).val("Deselect All");
    			$selected = 1;
    		} else {
    			$(this).closest("form").find("input[name='pid[]']").prop({checked: false});
    			$(this).closest("form").find('img').removeClass("selectedDownload");
    			$(this).val("Select All");
    			$selected = 0;
    		}
    	});

    Finally, and the most important part, I’m trying to link to a completely different path, either to just a separate directory on the server OR to the cloud (AmazonS3 or Azure) and therefore need to update/rewrite each image path before it’s grabbed for the zip.

    I tried changing the following to set a different folder but am still linking to the lo-res and not sure why?

    File: nextgen-download-gallery.php

    Your code: (@ ln#242)

    foreach ($images as $image) {
    				$image = $nggdb->find_image($image);
    				if ($image) {
    					$loRes = $image->imagePath;
    				}
    			}

    my code:

    foreach ($images as $image) {
    				$image = $nggdb->find_image($image);
    				if ($image) {
    					$loRes = $image->imagePath;
    					$loResSrc =  pathinfo($loRes);
    					$loResImgName = $loResSrc['basename'];
    					$loResImgDir = basename( $loResSrc['dirname'] );
    					list($initialPath,$localPath) = explode("gallery",$loRes);
    					$files[] = $initialPath . "gallery/client-hi-res/" . $loResImgDir ."/" . $loResImgName;
    				}
    			}

    Any help to what I could do to either pass in a “basepath” as an argument via shortcode (best) or to force a new path as I’m trying to above (ok) would be immensely appreciated!

    This is behind password protected pages but would be happy to set something up for you to see if you would like, just let me know?

    Thank you for your time and patience, I look forward to anyone’s reply!

    Jon

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

Viewing 8 replies - 16 through 23 (of 23 total)
  • Plugin Author webaware

    (@webaware)

    @mellowvision: please start a new topic, and fully describe your problem. This thread has more than one issue discussed already, I need you to please be specific in describing your problem in a new topic.

    cheers,
    Ross

    If you enable ‘back up images’ in the Nextgen options you can download the hires backed-up version rather than the web res version displayed on the site.

    Change the hires file path to
    $hiRes = $initialPath . "gallery/" . $loResImgDir ."/" . $loResImgName."_backup";

    Anyone know how to strip the _backup off the name before zipping?

    Plugin Author webaware

    (@webaware)

    G’day cevenson,

    El_Duderino in a post above tells how he did it. The next version of this plugin has a filter ngg_dlgallery_zip_pre_add that will allow you to specify the PCLZIP_CB_PRE_ADD filter without hacking the plugin; I hope to have it out by early next week, just need to find some time to finalise a couple of things.

    Very soon (I keep promising!) I’ll have a premium plugin available that will cleanly handle all of this without need for modifications. Just need a little more clear air!

    cheers,
    Ross

    Ahh. Should have read the whole lot. Thanks

    Hey guys, new user here so pardon if I miss something, but how does it know where to find the hi-res files? Is there a way to make it auto locate the backups that are created after gallery resizes them?

    sorry I see cevenson posted it, ill need to figure it out, my apologies

    For me it is still hard to understand how to strip the _backup off the name before zipping. Can anyone tell me what code to put were. with the _backup in the file name the download plugin is useless to me.

    Hi there,

    Thank you for the plug-in, and those who have contributed to this post. It has gotten me very close to what my client needs (basically, just to download the Hi Res / backup version of the file)

    Do you think it would be possible to receive a quick summary of @el_duderino‘s methods, with snippets?

    So far I have made the plug-in add on, and I have copied the code @cevenson posted into “NextGEN Download HiRes add-on”

    $hiRes = $initialPath . "gallery/" . $loResImgDir ."/" . $loResImgName."_backup";

    Thanks very much for your time.

Viewing 8 replies - 16 through 23 (of 23 total)
  • The topic ‘Linking to HR images (again)’ is closed to new replies.