We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 12236
    • 48 Posts
    Digital Butter - MODX Premiere Partners Reply #11, 16 years, 1 month ago
    Quote from: dj13 at Aug 30, 2010, 01:19 PM

    Quote from: jtech at Aug 30, 2010, 12:15 PM

    Hey DJ13,

    Great work again! I just re-submitted the package to the modx repo with your last changes. What might be a practical use of only outputting the image source as opposed to just calling the TV unaltered by scripts? Flexibility is always nice, but I’m a bit slow today so I’m having trouble thinking of a way to use the "source only" feature.

    Perhaps I can pick your brain a little bit on something.. The last feature that this snippet is missing is the ability to connect to the phpthumb installation that is already a part of modx. My original implementation of including the whole phpthumb script is a bit bulky and unnecessary. Thankfully phpthumb is a light weight script so it isn’t too big of a deal, but it would be nice to utilize what is already available (similar to Gallery).

    I have been studying the modx docs trying to familiarize myself with "connectors" (I think they are what is needed?) but haven’t figured out much. Do you have any ideas on how to accomplish this?

    Again, great work! It is really neat to see little ideas grow into useful products when placed in the hands of an excellent community!

    Choice only source would be useful to dynamically create Java script (maybe and CSS) when is not needed the entire image tag, but only the source of the image.
    I’m new into Modx world, and also study the documentation.I do not know how, and whether it is possible to utilize integrated MODx phpthumb. If anyone knows please help.
    I agree with You about the community. Thank You for your support.


    +1 for source only as an option smiley This gives real flexibility if you’re trying to do anything other than just display a thumbnail, e.g. linking to an image.
      • 14951
      • 151 Posts
      Excellent...I can see that now! I’ll add it to the next revision. Hopefully someone can send some insight on how to accomplish connecting this to the core install of phpthumb in the mean time!

      Thanks!
        • 36607 ☆ A M B ☆
        • 44 Posts
        Hi Guys, I don’t fully understand and have a couple of questions (sorry if these are really noob queries):

        1. Why does the TV output type have to be text? I want to use 1 image in several different context and at different sizes. It seems to be that when I use the TV content element eg [[*tv]], there is no image and all I have is the text eg, assets/components/images/photo.jpg

        2. Can I use the output filter on a tv content tag eg [[+tv:phpthumb=`&w=100&h=50&zc=1,class||myClass,title||myTitle,style||border: 1px solid #333`]]? I have tried to do so in a tpl chunk that is called by getresources, but it doesn’t work.

        My getresources call:
        [[!getResources? 
        &parents=`3` 
        &limit=`4` 
        &tplFirst=`articleheadline` 
        &tpl_2=`articlesnextheadlines1` 
        &tpl_3=`articlesnextheadlines2` 
        &tpl_4=`articlesnextheadlines3` 
        &includeContent=`1` 
        &sortby=`createdon` 
        &showHidden=`1` 
        &sortDir=`DECS` 
        &includeTVs=`1` 
        &tvPrefix=``]] 


        My chunk:
        <div class="col3 left">
        <div class="column-content">
        <div class="post">
        <p><a href="[[~[[+id]]]]"><img src="[[+articleimage:phpthumb=`&w=185&h=100&zc=1, class="bordered", title=""`]]" /></a></p>
        <h4><a href="[[~[[+id]]]]">[[+pagetitle]]</a></h4>
        <p>[[+introtext:default=`[[+content:ellipsis=`70`]]`]]</p>
        </div>
        </div>
        </div>
          • 14951
          • 151 Posts
          Hey ModxNovice,

          The best way to accomplish what (I think) you are attempting to, is use the "source only" option. I think if you do your chunk like this it will work...
          <div class="col3 left">
          <div class="column-content">
          <div class="post">
          <p><a href="[[~[[+id]]]]"><img src="[[phpthumb? &input=`[[+articleimage]]` &options=`&w=185&h=100&zc=1` &onlysrc=`1`]]" class="bordered" title="" /></a></p>
          <h4><a href="[[~[[+id]]]]">[[+pagetitle]]</a></h4>
          <p>[[+introtext:default=`[[+content:ellipsis=`70`]]`]]</p>
          </div>
          </div>
          </div>
          


          Let me know if you still have issues.

          Thanks,
          -Jared

          EDIT: P.S. Make sure you are using the latest version of the snippet v0.6.1
            • 36607 ☆ A M B ☆
            • 44 Posts
            Thanks jtech. I’ll check this out and let yo know how I get on.

            Another query though, I currently want to show the same image on a separate content page. This is the full image and doesn’t need the phpthumbfilter output modifications. I have assigned the TV to my template and placed the following tag: [[*articleimage]]. Prior to changing my output type to Text, I had an output of Image and the tag worked fine (ie, the full image was displayed where I wanted it).

            However, since I changed the output type of this TV to Text, the image isn’t displaying, just the text ie assets/components/images/image.jpg.

            I’m a bit stumped!
              • 14951
              • 151 Posts
              Hey again ModxNovice,

              I’m not sure what your exact situation is, but in this case I’d wrap your tv in an image tag manually.
              <img src="[[*yourTV]]" alt=" "/>


              The reason that you are required to use an output type of Text for the PHPThumb filter is that the filter builds the image tag for you. If you used an output type of image...you would end up with something like <img src="<img src="path/to/image.jpg" />" alt=" " /> ...which as you can see wouldn’t work very well.

              If anyone knows of a way to detect what type of output the TV uses or a way to SET what type of output the tv uses in the snippet code...I could make a conditional... I’m really not sure how to do it or if it’s even possible though.

              P.S. We should probably bump this conversation in to the version 0.6 forum topic so as not to cause any confusion. Is version 0.6.1 the version you are using?
                • 36607 ☆ A M B ☆
                • 44 Posts
                Hey Jtech

                Did what you suggested with the chunk and it works a treat, just as I wanted.

                I am using version 0.6.1 and agree that this conversation needs to be bumped accross to the forum topic.

                Really love this snippet now I understand how to work it.

                Thanks for your help.

                smiley