We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 31979
    • 26 Posts
    I am right now beginning to understand the philosophy and underlying concepts behind MODx. May I ask a few questions:  huh

    The proper way to add scaling, cropping and thumbnailing of images to MODx would be with a widget?

    I assume that Template Variables and Widgets are part of the core code and the user is not meant to add new widgets? 

    Is there a way to retrieve the raw value of a Template Variable that has already a widget assigned?

    Would it be a good idea to add a Template Variable "Image List" to the available TVs so that creators of gallery snippets could plug into that, and need not develop a own user interface for adding images?
      www.waso.com
      • 727
      • 502 Posts
      I can’t answer all your questions, so...

      I think widgets are applied to the output of a template variable, so if you do your image resizing there then it will happen every time you load the page, which would be a bad idea. It’s better to create the thumbnails one time only and then display them when needed.
      Maxigallery creates thumbnails and displays them, so that might be an option. Maxigallery is a snippet.

      Andy
        • 22303 MODX Staff
        • 10,725 Posts
        Quote from: waso at Sep 26, 2006, 09:28 AM

        The proper way to add scaling, cropping and thumbnailing of images to MODx would be with a widget?

        I assume that Template Variables and Widgets are part of the core code and the user is not meant to add new widgets?
        Proper in MODx is generally whatever approach best meets your specific site requirements/needs. The built-in widgets do not provide this capability.

        Quote from: waso at Sep 26, 2006, 09:28 AM

        Is there a way to retrieve the raw value of a Template Variable that has already a widget assigned?
        Yes, there are API functions to retrieve template variables, including the widget properties.

        Quote from: waso at Sep 26, 2006, 09:28 AM

        Would it be a good idea to add a Template Variable "Image List" to the available TVs so that creators of gallery snippets could plug into that, and need not develop a own user interface for adding images?
        That’s not a bad idea, but I’d rather see this happen following some upcoming refactorings that will make creating a distributing these widgets (and template variables) as add-on packages which can be used like libraries of building blocks for custom galleries (or any other web application).

        Quote from: ajayre at Sep 26, 2006, 11:53 AM

        I think widgets are applied to the output of a template variable, so if you do your image resizing there then it will happen every time you load the page, which would be a bad idea. It’s better to create the thumbnails one time only and then display them when needed.
        Actually, widgets do define both output and input behavior (via the manager or QuickEdit) when configuring a TV.

        Quote from: ajayre at Sep 26, 2006, 11:53 AM

        Maxigallery creates thumbnails and displays them, so that might be an option. Maxigallery is a snippet.
        Right, creating snippets to do this is probably the best approach to such things right now, and you can use those within TV’s in various ways, as well. In the future, I am planning on making Widgets be classes so managers can override core widgets or add their own custom ones which can filter output for both rendering and managing the TV’s.
          • 7923
          • 4,213 Posts
          you could use one tv for the image selection what would output the image using phpthumb. Then you could do multiple other tvs to set the various phpthumb filters and in the tv that outputs the image use these. Phpthumb caches the generated images so there will be no problems on speed/resource hogging.


            "He can have a lollipop any time he wants to. That's what it means to be a programmer."
            • 25663 MODX Staff
            • 12,272 Posts
            I believe TVs support @DIRECTORY now, so you could get the results of a filesystem folder that way...
              Ryan Thrash, MODX Co-Founder
              Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me