We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 28626
    • 87 Posts
    This is an auto-generated topic for ProtectImage 1.0-beta by stofke72.

    Brief Description:

    * @param &PrImgPath The path to the image you want to protect (required).
    * @param &PrImgId The id (as in css) of the image you want to protect (optional).
    * @param &PrObfusc This obfuscates the image path if set to anything else but zero (optional).
    * @param &PrAlt The alt attribute for the image you want to protect (optional, but needed for W3C validation).

    * @example [[ProtectImage? &PrAlt=`My Protected Image` &PrImgId=`myImageId` &PrImgPath=`assets/images/myImage`]]
    * Will return
    * <img id="myImageId" alt=`My Protected Image` src="data:image/png;base64,iVBO...II=" style=" width:230px; height:80px;"/>.
    *
    * @example [[ProtectImage? &PrAlt=`My Protected Image` &PrImgPath=`assets/images/myImage` &PrObfusc=`1`]]
    * Will return
    * <img alt=`My Protected Image` src="data:image/png;base64,iVBO...II=" style="background: url(&#116;...&#x67;); width:230px; height:80px;"/>
    *
    * This snippet puts the provided image as background image and replaces it with
    * a transparent image. This way it’s harder to download the image, it also
    * obfuscates the path to the image in the source.
    *
    * If you use the imgId parameter you should create an id in your stylesheet
    * with a background set to your imagepath.
    * if you do not supply a PrImgId parameter the style is created inline.

    Initial version
      • 3866 ☆ A M B ☆
      • 350 Posts
      Ok I’ve tried to use this snippet and whilst I do put in the correct path for the image I keep getting the same error message of
      This is a required parameter please provide a path to your image e.g. &imgPath=`assets/images/xxx.jpg`
      My images are not stored is assets/images but to a different path which is correct because the image is inserted, however, when I put the image path into the snippet I get the error message. Additionally there is no alt tag returned so the page would not pass validation.
      Like the idea behind this snippet as copyright issues on images can be problematic.
        Helen Warner
        Number one pixel!
        Proud to be linked with MODX at Crimson Pixel
        • 28626
        • 87 Posts
        Good point about the alt attribute. I’ll add that soon.
        Not sure about why your path doesn’t work, what’s your path?

        I noticed I had some wrong names in the variables, it should be &PrImgPath=`assets/images/test.png`

        I’ll release a new version with alt.

        [[ProtectImage? &PrObfusc=`1` &PrAlt=`My Protected Image` &PrImgPath=`assets/images/test.png`]]
          • 8924
          • 10 Posts
          May I ask if there is a possibility of giving other styles properties, like size, border and so on?

          Thanks

          Enumaelis
            • 3866 ☆ A M B ☆
            • 350 Posts
            Hi there, have successfully used this package however, in IE7 it leaves the awful little white box with a cross in it in top right hand corner obviously the background image src - is there a way of removing this? Thanks
              Helen Warner
              Number one pixel!
              Proud to be linked with MODX at Crimson Pixel