Can't allow free downloads for clients

13»

Comments

  • jfriendjfriend Registered Users Posts: 8,097 Major grins
    edited March 7, 2009
    jchin wrote:
    Would removing this code from the script ignore the right-click protection?
    Removing that piece of code would make the download button show when right-click protection is on, but it wouldn't work because Smugmug prevents the download photo option from working when right-click protection is on (as I recall, you end up downloading a blank gif or something like that). So, there is no point in having a download button that doesn't work. Anyway, I see no point in having right-click protection on when you are letting people download originals (since it isn't accomplishing anything), so people who want downloads might as well turn right-click protection off.
    --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 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.
    As jchin said, right-click protection must be OFF for the download option to work. I don't allow PMs. You can email me the password via my profile.
    --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 8, 2009
    jfriend wrote:
    As jchin said, right-click protection must be OFF for the download option to work. I don't allow PMs. You can email me the password via my profile.

    I meant off. Sorry. It is off, and no button. I'll email you the password.
  • jfriendjfriend Registered Users Posts: 8,097 Major grins
    edited March 8, 2009
    I meant off. Sorry. It is off, and no button. I'll email you the password.
    In that gallery, you have no customization so the download button javascript is not present. I think that's probably because you have "Appearance" set to "Smugmug", not set to "Custom" in the customize gallery screen.
    --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 8, 2009
    jfriend wrote:
    In that gallery, you have no customization so the download button javascript is not present. I think that's probably because you have "Appearance" set to "Smugmug", not set to "Custom" in the customize gallery screen.

    That's so weird. I originally had it set to custom, and it wasn't working. So I thought by when you said it had to be the smugmug setting, I thought you might have meant that, so I switched it, and it still didn't work. I think my site was just acting weird today so the button wasn't working.

    That fixed it though. Good to go. Thank you so much!

    Is there a way to enable this though so that the original doesn't have to be selected? Can I have it set to large, or XL and be able to have the download button? Possibly by switching the code around in the last part where it says:
    jfriend wrote:
    {
    // construct the download URL
    window.location = "/photos/" + ImageID + "_" + ImageKey + "-D.jpg";
    }
    ?
  • jfriendjfriend Registered Users Posts: 8,097 Major grins
    edited March 8, 2009
    That's so weird. I originally had it set to custom, and it wasn't working. So I thought by when you said it had to be the smugmug setting, I thought you might have meant that, so I switched it, and it still didn't work. I think my site was just acting weird today so the button wasn't working.

    That fixed it though. Good to go. Thank you so much!

    Is there a way to enable this though so that the original doesn't have to be selected? Can I have it set to large, or XL and be able to have the download button? Possibly by switching the code around in the last part where it says:

    ?

    No, I know of no way to make this kind of download work with any other size. The smugmug download URL only works with the original. It's Smugmug server-side functionality that triggers the download in the browser and it only works with the original size.
    --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 8, 2009
    Never mind. That would be the wrong part of the code. I saw the part about the originals. I guess the only way that I could do that for that specific gallery would be to upload the photos to smugmug at the "large" size by cropping them in my PP software correct? Otherwise it would apply that download button to all my pages. Unless...No. Because my "for sale" galleries don't have right-click protection turned off, so the button wouldn't be there correct? or it just wouldn't work actually I think, which is stupid. So yeah, I would just need to upload smaller files.

    *sorry for the thought process, I tend to type what I'm thinking*
  • jfriendjfriend Registered Users Posts: 8,097 Major grins
    edited March 8, 2009
    Never mind. That would be the wrong part of the code. I saw the part about the originals. I guess the only way that I could do that for that specific gallery would be to upload the photos to smugmug at the "large" size by cropping them in my PP software correct? Otherwise it would apply that download button to all my pages. Unless...No. Because my "for sale" galleries don't have right-click protection turned off, so the button wouldn't be there correct? or it just wouldn't work actually I think, which is stupid. So yeah, I would just need to upload smaller files.

    *sorry for the thought process, I tend to type what I'm thinking*

    Yes, a separate gallery where the originals are actually smaller files is the only way I know of to make the download button both appear and work with smaller files.
    --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 8, 2009
    jfriend wrote:
    Yes, a separate gallery where the originals are actually smaller files is the only way I know of to make the download button both appear and work with smaller files.

    Figured. Thank you for all your help.
  • BobbyMarshallBobbyMarshall Registered Users Posts: 57 Big grins
    edited April 8, 2011
    jfriend wrote: »
    Edited to include the latest version of the code

    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.
    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";
    }
    
    

    This should result in a download button that looks like this:

    2009-01-25_2104.png



    Just wanted to say thanks for this script. Just what I needed
    Canon 50D | EF-S 17-55 f/2.8 IS | 70-200 f/2.8L IS
    2x White Lightning x1600 | 580 EXII
    Sekonic L-358 | 2x Pocket Wizard II | TC-80N3 Remote Shutter

  • Studio Simplicity JennyStudio Simplicity Jenny Registered Users Posts: 14 Big grins
    edited May 1, 2011
    Hi! Does anyone know if this is still working? I cut and pasted the code and made sure my originals are enabled. I still can't see the download link. Any help is much appreciated!!
  • jfriendjfriend Registered Users Posts: 8,097 Major grins
    edited May 1, 2011
    Hi! Does anyone know if this is still working? I cut and pasted the code and made sure my originals are enabled. I still can't see the download link. Any help is much appreciated!!
    The script works and we could help you figure out why it isn't working if you included a link to your Smugmug site and to a non-password protected gallery that has originals enabled. The link in your signature now does not appear to be your smugmug site.
    --John
    HomepagePopular
    JFriend's javascript customizationsSecrets for getting fast answers on Dgrin
    Always include a link to your site when posting a question
Sign In or Register to comment.