Can't allow free downloads for clients

2

Comments

  • BrewmasterBrewmaster Registered Users Posts: 155 Major grins
    edited February 24, 2009
    jfriend wrote:
    Here's the code. It automatically detects whether originals are enabled and just adds the download button if originals are enabled and doesn't if they aren't. It is only configured to work in Smugmug view. Just paste this code into your bottom javascript.
    onPhotoShow.subscribe(ProcessDownloadButton);
    
    function IsSmugmugView()
    {
        return(YD.hasClass(document.body, "smugmug"));
    }
    
    
    function ProcessDownloadButton()
    {
        if (IsSmugmugView())
        {
            if (photoInfo[ImageID].albumOriginals && (photoInfo[ImageID].Format !== "MP4"))
            {
                InsertDownloadButton("cartButtonsWrapper");
            }
        }
    }
    
    function InsertDownloadButton(parentId)
    {
        // now add the download button
        var parentDiv = document.getElementById(parentId);
        var downloadButton = document.getElementById("downloadButtonId");
        if (parentDiv && !downloadButton)
        {
            var downloadButtonInfo =
            {
                id: "downloadButtonId",
                label: "Download Image...",
                container: parentDiv,
                type: "button",
                className: "sm-button sm-button-small themesButton glyphButton",
                onclick: { fn: InitiateDownloadImage }
            };
            
            var dButtonObj = new YAHOO.widget.Button(downloadButtonInfo);
        }
    }
    
    function InitiateDownloadImage()
    {
        // construct the download URL
        window.location = "/photos/" + ImageID + "_" + ImageKey + "-D.jpg";
    }
    
    This should result in a download button that looks like this:

    2009-01-25_2104.png

    I tried this code, but it doesn't seem to work for me, what did I do wrong?
    http://mdmphoto.smugmug.com/
  • jfriendjfriend Registered Users Posts: 8,097 Major grins
    edited February 24, 2009
    Brewmaster wrote:
    I tried this code, but it doesn't seem to work for me, what did I do wrong?
    http://mdmphoto.smugmug.com/
    The code, as written, assumes that the buy buttons are in the gallery and uses them to locate where the download button should go. Since you have the Smugmug buy buttons disabled, it can't find where to put the button so it doesn't do anything.

    You can change this function to what I have below and it should work for you:
    function ProcessDownloadButton()
    {
        if (IsSmugmugView())
        {
            if (photoInfo[ImageID].albumOriginals && (photoInfo[ImageID].Format !== "MP4"))
            {
                InsertDownloadButton([COLOR=red]"altViews"[/COLOR]);
            }
        }
    }
    
    --John
    HomepagePopular
    JFriend's javascript customizationsSecrets for getting fast answers on Dgrin
    Always include a link to your site when posting a question
  • Erick LErick L Registered Users Posts: 355 Major grins
    edited February 24, 2009
    Great stuff John. I just changed the text to "Dowload Original".

    Thanks!
  • ericserics Registered Users Posts: 7 Beginner grinner
    edited February 26, 2009
    Awesome! Just put the download button code it and love it. Thanks!! clap.gifclapclap.gif
  • coxyukcoxyuk Registered Users Posts: 19 Big grins
    edited March 1, 2009
    I really like that code John, helpful as always thumb.gif

    However what I have a slightly different requirement that someone may be able to advise on.

    I'm changing my workflow to put full size (rather than web sized) jpeg images on to Smugmug. This will effectively be the off site backup in my workflow. It's also great because I can set it so that viewers can see the images in web sized but not full sized.

    However what I'd like to do is enable other people who took part in the shoot to download the full sized image for free using a password that I supply to them without losing the public facing gallery and without uploading twice (to create a seperate pw protected gallery). Is this possible or likely to become so?

    I should also say that I use a smugmug feed and key words to supply my website with images so the galleries need to be public.
  • catspawcatspaw Registered Users Posts: 1,292 Major grins
    edited March 1, 2009
    So is there any chance of limiting the download size to, say, 'Medium' and then if they want more, they have to buy/order prints?
    //Leah
  • jfriendjfriend Registered Users Posts: 8,097 Major grins
    edited March 1, 2009
    coxyuk wrote:
    I really like that code John, helpful as always thumb.gif

    However what I have a slightly different requirement that someone may be able to advise on.

    I'm changing my workflow to put full size (rather than web sized) jpeg images on to Smugmug. This will effectively be the off site backup in my workflow. It's also great because I can set it so that viewers can see the images in web sized but not full sized.

    However what I'd like to do is enable other people who took part in the shoot to download the full sized image for free using a password that I supply to them without losing the public facing gallery and without uploading twice (to create a seperate pw protected gallery). Is this possible or likely to become so?

    I should also say that I use a smugmug feed and key words to supply my website with images so the galleries need to be public.

    If you have a pro account (which I assume you do), you could look into using the guest admin password to give the other shooters access to the originals. I don't know if it will do what you want, but it's worth a look.
    --John
    HomepagePopular
    JFriend's javascript customizationsSecrets for getting fast answers on Dgrin
    Always include a link to your site when posting a question
  • jfriendjfriend Registered Users Posts: 8,097 Major grins
    edited March 1, 2009
    catspaw wrote:
    So is there any chance of limiting the download size to, say, 'Medium' and then if they want more, they have to buy/order prints?
    If you limit the available web display to the medium size and don't watermark and don't right-click-protect, then you could let your users simply right-click to save the medium sizes. I don't know how to make the download button script work with the medium size though.

    The challenge with this is that you'd have to limit your display sizes to medium which I think is really pretty small in order to assess the quality of the image before buying. I, myself, would rarely buy something that I couldn't look at larger than medium, but there are many sites that do sell with that limitation so I may be a pickier buyer than most.
    --John
    HomepagePopular
    JFriend's javascript customizationsSecrets for getting fast answers on Dgrin
    Always include a link to your site when posting a question
  • catspawcatspaw Registered Users Posts: 1,292 Major grins
    edited March 1, 2009
    jfriend wrote:
    If you limit the available web display to the medium size and don't watermark and don't right-click-protect, then you could let your users simply right-click to save the medium sizes. I don't know how to make the download button script work with the medium size though.

    The challenge with this is that you'd have to limit your display sizes to medium which I think is really pretty small in order to assess the quality of the image before buying. I, myself, would rarely buy something that I couldn't look at larger than medium, but there are many sites that do sell with that limitation so I may be a pickier buyer than most.

    Hmm, yeah I like the idea of the 'download' button more than anything else. I swear, trying to explain right clicking to folks is more trouble than its worth (in spite of the simplicity of the concept). I'd upload just a 'medium' sized image, but then it'd be too small to order a print from (Even if I do replace prints during the proof stage), so ... yeah. bother!

    I think I'll look into the smallest allowable image size (I saw that elsewhere... somewhere...) and export from lightroom at that size at least. Right now I'm trying to drive traffic to my site (especially for low volume events) in any form, including watermarked smaller 'free' downloads. (aka lollpops to sucker you into print orders)

    thanks!
    //Leah
  • coxyukcoxyuk Registered Users Posts: 19 Big grins
    edited March 1, 2009
    jfriend wrote:
    If you have a pro account (which I assume you do), you could look into using the guest admin password to give the other shooters access to the originals. I don't know if it will do what you want, but it's worth a look.

    Thanks John - it's worth a look but I'd prefer to give them access to their images rather than all. I guess I can put them on S3 for now and give them the links nod.gif
  • BrewmasterBrewmaster Registered Users Posts: 155 Major grins
    edited March 1, 2009
    Thanks!
    jfriend wrote:
    The code, as written, assumes that the buy buttons are in the gallery and uses them to locate where the download button should go. Since you have the Smugmug buy buttons disabled, it can't find where to put the button so it doesn't do anything.

    You can change this function to what I have below and it should work for you:
    function ProcessDownloadButton()
    {
        if (IsSmugmugView())
        {
            if (photoInfo[ImageID].albumOriginals && (photoInfo[ImageID].Format !== "MP4"))
            {
                InsertDownloadButton([COLOR=red]"altViews"[/COLOR]);
            }
        }
    }
    

    Thanks....worked perfectly!
  • BrewmasterBrewmaster Registered Users Posts: 155 Major grins
    edited March 1, 2009
    New twist on this
    Ok, here is one for you. If I customize my galleries to only show something "not" original size, this seems to work fine within the gallery. However.....I have keywords on my homepage, and when photo's are brought up via keyword, both the "buy" button, and the "download image" button show up.

    So, how do I eliminate the "buy" and "download image" buttons in the situation where keywords are used to show various photos from many galleries?
  • jfriendjfriend Registered Users Posts: 8,097 Major grins
    edited March 1, 2009
    Brewmaster wrote:
    Ok, here is one for you. If I customize my galleries to only show something "not" original size, this seems to work fine within the gallery. However.....I have keywords on my homepage, and when photo's are brought up via keyword, both the "buy" button, and the "download image" button show up.

    So, how do I eliminate the "buy" and "download image" buttons in the situation where keywords are used to show various photos from many galleries?
    I can only really see what you're talking about if you post a link to the page in question and then let me know what is or isn't working. I can't follow the theoretical question, nor do I like to offer advice without seeing the actual page so I can see what's really happening on your site.
    --John
    HomepagePopular
    JFriend's javascript customizationsSecrets for getting fast answers on Dgrin
    Always include a link to your site when posting a question
  • BrewmasterBrewmaster Registered Users Posts: 155 Major grins
    edited March 1, 2009
    jfriend wrote:
    I can only really see what you're talking about if you post a link to the page in question and then let me know what is or isn't working. I can't follow the theoretical question, nor do I like to offer advice without seeing the actual page so I can see what's really happening on your site.
    Sorry, here is the link to a typical gallery:

    http://mdmphoto.smugmug.com/gallery/7238609_PQVno#465112738_vCx7J

    Notice in this gallery, I do not have the "download image" button showing since I customized the gallery as suggested to a smaller size. Now, here is a link from my homepage to a picture that is within the gallery above, but was accessed through clicking one of the keywords on my home page:

    http://mdmphoto.smugmug.com/keyword/alaska#469868018_uoKw7

    In this way, the "download image" button now appears even though the sizes of the images were set to less than the "original" size.

    And also, even though on every gallery I have disabled printing to make the smugmug "buy" buttons go away, every picture that can be accessed through a keyword on my homepage can be printed as the "buy" button will show up.
  • coxyukcoxyuk Registered Users Posts: 19 Big grins
    edited March 1, 2009
    Brewmaster wrote:
    Sorry, here is the link to a typical gallery:

    http://mdmphoto.smugmug.com/gallery/7238609_PQVno#465112738_vCx7J

    Notice in this gallery, I do not have the "download image" button showing since I customized the gallery as suggested to a smaller size. Now, here is a link from my homepage to a picture that is within the gallery above, but was accessed through clicking one of the keywords on my home page:

    http://mdmphoto.smugmug.com/keyword/alaska#469868018_uoKw7

    In this way, the "download image" button now appears even though the sizes of the images were set to less than the "original" size.

    And also, even though on every gallery I have disabled printing to make the smugmug "buy" buttons go away, every picture that can be accessed through a keyword on my homepage can be printed as the "buy" button will show up.

    I've noticed the buy button on my keyword gallery previously and wasn't sure how to get rid of it. However, although the download button is there it doesn't work.
  • jfriendjfriend Registered Users Posts: 8,097 Major grins
    edited March 1, 2009
    Brewmaster wrote:
    Sorry, here is the link to a typical gallery:

    http://mdmphoto.smugmug.com/gallery/7238609_PQVno#465112738_vCx7J

    Notice in this gallery, I do not have the "download image" button showing since I customized the gallery as suggested to a smaller size. Now, here is a link from my homepage to a picture that is within the gallery above, but was accessed through clicking one of the keywords on my home page:

    http://mdmphoto.smugmug.com/keyword/alaska#469868018_uoKw7

    In this way, the "download image" button now appears even though the sizes of the images were set to less than the "original" size.

    And also, even though on every gallery I have disabled printing to make the smugmug "buy" buttons go away, every picture that can be accessed through a keyword on my homepage can be printed as the "buy" button will show up.

    This image: http://mdmphoto.smugmug.com/keyword/alaska#469868018_uoKw7 is in a gallery that has buying enabled and originals enabled (http://mdmphoto.smugmug.com/gallery/7236511_LzBPa/1/469868018_uoKw7#469868018_uoKw7). That's why the download image button shows up. I don't know what Smugmug's rules are for showing the buy button in keyword galleries, but I do notice that you can't actually buy an image like this one (http://mdmphoto.smugmug.com/keyword/alaska#466048666_oNaaT) because "This Photo" is grayed out.
    --John
    HomepagePopular
    JFriend's javascript customizationsSecrets for getting fast answers on Dgrin
    Always include a link to your site when posting a question
  • BrewmasterBrewmaster Registered Users Posts: 155 Major grins
    edited March 1, 2009
    jfriend wrote:
    This image: http://mdmphoto.smugmug.com/keyword/alaska#469868018_uoKw7 is in a gallery that has buying enabled and originals enabled (http://mdmphoto.smugmug.com/gallery/7236511_LzBPa/1/469868018_uoKw7#469868018_uoKw7). That's why the download image button shows up. I don't know what Smugmug's rules are for showing the buy button in keyword galleries, but I do notice that you can't actually buy an image like this one (http://mdmphoto.smugmug.com/keyword/alaska#466048666_oNaaT) because "This Photo" is grayed out.

    Actually, the gallery does not have buying (through smugmug gallery customization) enabled, and originals are not enabled either on that gallery. I just double checked it and the largest size I enabled is just below "O" (I assume that "O" is originals... so if I'm wrong, please let me know). The "download image" button does not show up in the actual gallery for me. But, if I go through the keyword to access a picture in that particular gallery, it is possible to download it through the download button that appears. The buy button you see in the gallery is one that I put in through my CSS page for a paypal purchase. Your right about not being able to buy a print, I didn't catch that it was grayed out, so that part is ok.
  • jfriendjfriend Registered Users Posts: 8,097 Major grins
    edited March 1, 2009
    Brewmaster wrote:
    Actually, the gallery does not have buying (through smugmug gallery customization) enabled, and originals are not enabled either on that gallery. I just double checked it and the largest size I enabled is just below "O" (I assume that "O" is originals... so if I'm wrong, please let me know). The "download image" button does not show up in the actual gallery for me. But, if I go through the keyword to access a picture in that particular gallery, it is possible to download it through the download button that appears. The buy button you see in the gallery is one that I put in through my CSS page for a paypal purchase. Your right about not being able to buy a print, I didn't catch that it was grayed out, so that part is ok.
    So, can you remind me again, what problem you want help with?
    --John
    HomepagePopular
    JFriend's javascript customizationsSecrets for getting fast answers on Dgrin
    Always include a link to your site when posting a question
  • brandofamilybrandofamily Registered Users Posts: 2,013 Major grins
    edited March 2, 2009
    I added your JS for the download button, but there seems to be a glitch...

    In my popular photos gallery this image is not set for originals:
    http://www.brandolinoimaging.com/popular/10/331558422_eKNCA#239682287_ASTdJ

    But this one is:
    http://www.brandolinoimaging.com/popular/10/331558422_eKNCA#250241742_ADRoB

    As soon as I click the sencond image, the download button stays for all of them. It only allows for the downloading of a spacer gif, but it might be misleading to a viewer... Can this be fixed?
    Awesome code BTW... :D
  • jfriendjfriend Registered Users Posts: 8,097 Major grins
    edited March 2, 2009
    I added your JS for the download button, but there seems to be a glitch...

    In my popular photos gallery this image is not set for originals:
    http://www.brandolinoimaging.com/popular/10/331558422_eKNCA#239682287_ASTdJ

    But this one is:
    http://www.brandolinoimaging.com/popular/10/331558422_eKNCA#250241742_ADRoB

    As soon as I click the sencond image, the download button stays for all of them. It only allows for the downloading of a spacer gif, but it might be misleading to a viewer... Can this be fixed?
    Awesome code BTW... :D
    The code doesn't anticipate a gallery where some images have originals enabled and some do not since that doesn't normally happen (outside of search, keywords and popular). Would you rather the download button just not show in those special galleries or would you rather it show and hide itself depending upon which image is selected (which would make the buttons move around as you went to different images) or somehow disable the button when originals are not disabled for that particular button, then re-enable it again?
    --John
    HomepagePopular
    JFriend's javascript customizationsSecrets for getting fast answers on Dgrin
    Always include a link to your site when posting a question
  • chrismoorechrismoore Registered Users Posts: 1,083 Major grins
    edited March 2, 2009
    jfriend wrote:
    The code doesn't anticipate a gallery where some images have originals enabled and some do not since that doesn't normally happen (outside of search, keywords and popular). Would you rather the download button just not show in those special galleries or would you rather it show and hide itself depending upon which image is selected (which would make the buttons move around as you went to different images) or somehow disable the button when originals are not disabled for that particular button, then re-enable it again?

    My personal preference would be to hide that button altogether in the special galleries. If the viewer clicks "view in gallery" he/she would then be taken to the gallery with the download button enabled. Just my preference, though, I'm sure others would rather it the other way.
  • jfriendjfriend Registered Users Posts: 8,097 Major grins
    edited March 2, 2009
    chrismoore wrote:
    My personal preference would be to hide that button altogether in the special galleries. If the viewer clicks "view in gallery" he/she would then be taken to the gallery with the download button enabled. Just my preference, though, I'm sure others would rather it the other way.
    That's the least complicated solution to implement so I'll make a version that works that way sometime later today and post here when I have it.
    --John
    HomepagePopular
    JFriend's javascript customizationsSecrets for getting fast answers on Dgrin
    Always include a link to your site when posting a question
  • brandofamilybrandofamily Registered Users Posts: 2,013 Major grins
    edited March 2, 2009
    jfriend wrote:
    That's the least complicated solution to implement so I'll make a version that works that way sometime later today and post here when I have it.
    Thanks... I think that idea works fine...
  • BrewmasterBrewmaster Registered Users Posts: 155 Major grins
    edited March 2, 2009
    jfriend wrote:
    So, can you remind me again, what problem you want help with?

    Sorry jfiend, I changed a few things around, and now all is working as it should be. Not sure if it just took some time for the site to update, or if the changes I made corrected the issue I was seeing........or maybe I was just seeing things.
  • jfriendjfriend Registered Users Posts: 8,097 Major grins
    edited March 3, 2009
    chrismoore wrote:
    My personal preference would be to hide that button altogether in the special galleries. If the viewer clicks "view in gallery" he/she would then be taken to the gallery with the download button enabled. Just my preference, though, I'm sure others would rather it the other way.
    OK, here's a new version of the code that handles the non-gallery views more intelligently. Just replace the previous version with this one in your bottom javascript. By default, it only displays the download button in actual galleries, but I went ahead and implemented an option so that it will display it in other circumstances (search, popular, date) and then enable/disable the button as needed based on whether originals are available for the selected image. To enable the download button in these other views, you just change the variable onlyInGalleries to false. I also made the code aware of right-click protection so there is no download button if an image is right-click protected and made it so the code works without modification even if there are no "buy" buttons. Here's the new code.
    function IsSmugmugView()
    {
        return(YD.hasClass(document.body, "smugmug"));
    }
    
    function IsGalleryPage()
    {
        return(YD.hasClass(document.body, "galleryPage"));
    }
    
    // code to insert a download button for any gallery that has originals enabled
    
    onPhotoShow.subscribe(ProcessDownloadButton);
    
    function ProcessDownloadButton()
    {
        // set onlyInGalleries to true if you only want a download button in gallery views
        // set onlyInGalleries to false if you want a download button in other views too like (search, keywords, date, etc...)
        var onlyInGalleries = true;
        if (IsSmugmugView() && (IsGalleryPage() || !onlyInGalleries))
        {
            if (photoInfo[ImageID].albumOriginals && !photoInfo[ImageID]['protected'] && (photoInfo[ImageID].Format !== "MP4"))
            {
                var downloadParent = "cartButtonsWrapper";
                if (!document.getElementById("cartButtonsWrapper"))
                {
                    downloadParent = "altViews";
                }
                InsertDownloadButton(downloadParent);
            }
            else
            {
                // disable the button
                var downloadButton = YAHOO.widget.Button.getButton("downloadButtonId");
                if (downloadButton)
                {
                    downloadButton.set("disabled", true);
                }
            }
        }
    }
    
    function InsertDownloadButton(parentId)
    {
        // now add the download button
        var parentDiv = document.getElementById(parentId);
        var downloadButton = document.getElementById("downloadButtonId");
        if (downloadButton)
        {
            // make sure it is enabled
            YAHOO.widget.Button.getButton("downloadButtonId").set("disabled", false);
        }
        else if (parentDiv)
        {
            var downloadButtonInfo =
            {
                id: "downloadButtonId",
                label: "Download Image...",
                container: parentDiv,
                type: "button",
                className: "sm-button sm-button-small themesButton glyphButton",
                onclick: { fn: InitiateDownloadImage }
            };
            
            var dButtonObj = new YAHOO.widget.Button(downloadButtonInfo);
        }
    }
    
    function InitiateDownloadImage()
    {
        // construct the download URL
        window.location = "/photos/" + ImageID + "_" + ImageKey + "-D.jpg";
    }
    
    
    

    If you want to allow the download button in non-gallery views, you should also add this CSS to make the disabled state of the download button look right:

    /* support disabled style for YUI buttons */
    .yui-button-disabled {border-left: 1px solid #666666; border-right: 1px solid #666666;}
    --John
    HomepagePopular
    JFriend's javascript customizationsSecrets for getting fast answers on Dgrin
    Always include a link to your site when posting a question
  • Candid ArtsCandid Arts Registered Users Posts: 1,685 Major grins
    edited March 7, 2009
    Ok. So I enabled the originals in one specific gallery (all others are Large) and put the code mentioned earlier for the Download button in the bottom java script. I can't get the download button to appear in the gallery. Any ideas? It's a private gallery for my cousin of my niece, password protected.

    Any ideas?
  • jfriendjfriend Registered Users Posts: 8,097 Major grins
    edited March 7, 2009
    Ok. So I enabled the originals in one specific gallery (all others are Large) and put the code mentioned earlier for the Download button in the bottom java script. I can't get the download button to appear in the gallery. Any ideas? It's a private gallery for my cousin of my niece, password protected.

    Any ideas?

    I see in some of your regular galleries that you have right-click protection on. The download button will only appear if originals are enabled and right-click protection is not on. If you want any further help, I will need to see the specific gallery where you have originals enabled and it's not working so I can debug it.
    --John
    HomepagePopular
    JFriend's javascript customizationsSecrets for getting fast answers on Dgrin
    Always include a link to your site when posting a question
  • Candid ArtsCandid Arts Registered Users Posts: 1,685 Major grins
    edited March 7, 2009
    Ok, so I turned right-click protection on. Enabled the Original file size. Updated. Still don't see the button. The gallery is here. I'll PM you the password to get in if you need it.
  • jchinjchin Registered Users Posts: 713 Major grins
    edited March 7, 2009
    Ok, so I turned right-click protection on. Enabled the Original file size. Updated. Still don't see the button. The gallery is here. I'll PM you the password to get in if you need it.

    I think you need to turn right-click protection OFF.
    Johnny J. Chin ~ J. Chin Photography
    FacebookFlickrSmugMug
    SmugMug referral coupon code: ix3uDyfBU6xXs
    (use this for a discount off your SmugMug subscription)
  • jchinjchin Registered Users Posts: 713 Major grins
    edited March 7, 2009
    Would removing this code from the script ignore the right-click protection?
    ... !photoInfo[ImageID] && ...
    Johnny J. Chin ~ J. Chin Photography
    FacebookFlickrSmugMug
    SmugMug referral coupon code: ix3uDyfBU6xXs
    (use this for a discount off your SmugMug subscription)
Sign In or Register to comment.