We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 30497
    • 245 Posts
    The basic structure of one of my sites features a simple content area featuring text and an image left aligned next to the text.

    Rather than writing the HTML for each image, I need a solution for any content editor to simply browse and upload an image of their choosing.

    I can achieved this with Template Variables, but there is one problem - I can’t guarantee that every content editor will always resize an image to the required size before upload, so I want to set a "safety" maximum width and height for those cases. Does anyone have a suggestion for how I can achieve this functionality?

    Thanks.
      • 19315
      • 84 Posts
      I have just done something similar for my site. I use phpThumb to show the images, with the maximum height and width set in the call. Thus instead of showing the img as
      <img src="assets/images/photo.jpg" />

      I actually use
      <img src="assets/snippets/phpThumb/phpThumb.php?src=../../images/photo.jpg&w=80&h=80" /> 

      (There could be better solutions though!)

      Michal.
        • 6726
        • 7,075 Posts
        phpThumb is a solution, personnally I use the DirectResize plugin with TVs.

        DirectResize looks for the width and/org height attribute to resize your images (depending on which resizing mode you choose), which mean you can just write :

        [tt]<img src="[*my_image_tv*]" width="80" />[/tt]

        Pretty simple... DirectResize then rewrites the path to the cached resized image.
        Works pretty well !
          .: COO - Commerce Guys - Community Driven Innovation :.


          MODx est l&#39;outil id
          • 30497
          • 245 Posts
          Quote from: davidm at Jun 20, 2008, 07:11 AM

          phpThumb is a solution, personnally I use the DirectResize plugin with TVs.

          DirectResize looks for the width and/org height attribute to resize your images (depending on which resizing mode you choose), which mean you can just write :

          [tt]<img src="[*my_image_tv*]" width="80" />[/tt]

          Pretty simple... DirectResize then rewrites the path to the cached resized image.
          Works pretty well !

          Thanks to you both.

          David - DirectResize is a great solution and is really exactly what I was looking for - maxigallery for single images.