We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 4385
    • 372 Posts
    Jon you could also create something automatic, as long as you are creating the images (and naming them)

    <img src="../assets/images/[*alias*].jpg" /> or any varation

    or GetParent...


      DropboxUploader -- Upload files to a Dropbox account.
      DIG -- Dynamic Image Generator
      gus -- Google URL Shortener
      makeQR -- Uses google chart api to make QR codes.
      MODxTweeter -- Update your twitter status on publish.
      • 7869
      • 118 Posts
      I know this is possible, but I’m not a good enough coder to figure it out.

      Can anyone mod the RandomImage code so that it lets you input a custom height or width or both parameters rather than the snippet using the image’s exact dimensions from the GetImageSize function?

      Something like this...

      [!RandomImage? &folder=`assets/images/random` &border=`1` &width=`150`!]


      I want to use RandomImage to display some photo images at 400px wide, but the problem is some are 401px, 403px, etc.
      I also want to use the same snippet for some thumbnails at 100px wide, but some are 103px, etc. I know I can just hardcode these values into the snippet by replacing the $imgSize[3] (in the line of code below) and then create a duplicate snippet for each set of images I want to resize, but I’d like to do everything with just one RandomImage snippet. I know it’s possible, but I can’t figure it out.

      return( '<div id="rndImage"><img src="' . $image_name . '" ' . $imgSize[3] . ' alt="" border="' . $border . '" /></div>' );
        -Dorian
        • 12013
        • 61 Posts
        I am sure I am being very stupid, but is there a simple way to set the RandomImage snippet as a background image?
          • 7869
          • 118 Posts
          Quote from: hendo at Jun 23, 2008, 06:04 AM

          I am sure I am being very stupid, but is there a simple way to set the RandomImage snippet as a background image?
          Did you try calling the snippet in place of where you’d put the background image?
            -Dorian
            • 12013
            • 61 Posts
            I placed the call in the div where I wanted the image to appear, the div in question holds 2 further floating divs which were thrown out of position by the random image. I could not get them to sit above the image.

            obviously doing something wrong but cannot figure out what.
              • 12147
              • 182 Posts
              I have tried all of the random image generators I can find here (and some I found elsewhere) with no real success. I have 3 images across the top of the page, and I want NEED them each to load randomly (from a folder of imgs all the same size) at each page load. I’d like them to have alt tags in a perfect world.

              Can someone explain this one a little better, esp the "Yay, the chunk worked" comment? wink OR point me to a workable solution?

              Thanks! laugh