We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 30215
    • 79 Posts
    I want each document to have one "title" image. I have several categories and I am using Ditto for displaying documents in this categories. I would like to have this title image next to the name of the document and also larger version displayed when the document is opened (so finally at least two sizes). And also adding this title image shouldn’t be very difficult. I know there is a Image TV but I don’t know how to get its value with Ditto.

    Thanks!
      -- sorry for my english, bad teacher smiley
      • 7231
      • 4,205 Posts
      Create a TV for the small image and another one for the large image. In Ditto add the small image placeholder to the TPL chunk [+smallImage+] and int he template for the article page add the large image [*largeImage*]

      Notice that in the ditto tpl you use the [++] syntax and in the document you use [**] syntax for the placeholder.
        [font=Verdana]Shane Sponagle | [wiki] Snippet Call Anatomy | MODx Developer Blog | [nettuts] Working With a Content Management Framework: MODx

        Something is happening here, but you don't know what it is.
        Do you, Mr. Jones? - [bob dylan]
        • 30215
        • 79 Posts
        Hey, I didn’t know that using TVs in ditto is so easy, great smiley

        But using two different TVs isn’t a good solution. Especially because the user would have to to resize image manually and it is not very comfortable. I want the image to be resized and cropped automatically to fit the web layout.

        So far two ideas have come across my mind but I don’t know how possible they are:
        1) I found phpThumb which should be able to resize images on the fly.
        2) If it was possible to process values of TVs when saving document (maybe in mm_rules?), I could resize the image and create copies. In Ditto I would use some TV modifier to modify the given path.

        But I am kind of new in modx so I don’t know what is possible and what not... I am a little bit groping in the dark smiley
          -- sorry for my english, bad teacher smiley
          • 7231
          • 4,205 Posts
          I would go with phpThumb. That will work. I havent used phpThumb in a while, let us know how it goes.
            [font=Verdana]Shane Sponagle | [wiki] Snippet Call Anatomy | MODx Developer Blog | [nettuts] Working With a Content Management Framework: MODx

            Something is happening here, but you don't know what it is.
            Do you, Mr. Jones? - [bob dylan]
            • 30215
            • 79 Posts
            Ok, I will. But it is not going to be soon as I am quite busy right now with other stuff (school :-!). I am just exploring the possibilities of modx.
              -- sorry for my english, bad teacher smiley
              • 30215
              • 79 Posts
              So I tried phpThumb and it is working quite well.

              However it took whole evening to get it working. The code hasn’t been updated since 2008 and functions like ereg/eregi are now deprecated (in 5.3.0). So firstly I had to replace all of them with preg equivalents. The second problem was with &/& ’Something’ was replacing it once more than I wanted so finally I had to edit directly the snippet to solve this. Now everything seems to be ok.
                -- sorry for my english, bad teacher smiley