10 Replies Latest reply on Sep 22, 2008 4:51 AM by (Fritsie)

    show thumbnail with spry

      Hi,

      I want to upload images using ADDT.
      Normally I show the thumnails with the "show thumbnail"server behaviour.
      Now I want to create a spry image gallery.
      How can I get the thumnails with spry from the images which I have uploaded with the "Upload and Resize Image" serverbehaviour?
      Is this possible?

      Regards,
      C.J.
        • 1. Re: show thumbnail with spry
          Günter Schenk Level 4
          Hi Kees,

          the ADDT helpfile says:

          "No image thumbnail is actually created until the page containing a Show Thumbnail server behavior is requested in the browser for the first time. When a thumbnail is created on the server, it is saved in a folder called thumbnails, created inside the image upload folder (either statically or dynamically)."

          And this will pose a problem in your case, because the "Upload and Resize Image" behaviour doesn´t generate the thumbnails, means they don´t necessarily exist.

          Cheers,
          Günter Schenk
          Adobe Community Expert, Dreamweaver
          • 2. Re: show thumbnail with spry
            Level 1
            Hello folks!

            I got through this once. I wanted to create a Spry image gallery and be able to manage it dynamically using my CMS made with ADDT. The CMS had to upload, resize, create the thumbnails and generate the xml file to be consumed by Spry at the front end.

            First you redirect the user after inserting new images with ADDT to a dynamic nested list containing the new images thumbnails. The thumbnails are then created. Then, a variable attached to the url will tell your script to create the xml file everytime a new image is uploaded:

            if ($_GET['create'] == 'XML') {
            // create the xml (this one I hand coded -> "Export Recordset as XML" server behaviour will not do the job properly for the Spry Image Gallery
            }

            All of this goes on your back-end app. Your front-end will then save processing time because it doesn´t need to create the thumbs. Your image gallery will be purely AJAX.

            It worked fine for me. You can see the front-end at http://www.cressgo.org.br/FiquePorDentro/galerias.php

            (its all in portuguese so just click on any thumbs to select an album -> the gallery interface will then popup)

            Hope this help,

            Marcell
            • 3. Re: show thumbnail with spry
              Günter Schenk Level 4
              Hey Marcell,

              wow, that is one of the greatest suggestions I read since a long time :-)

              But...if Kees will be generating the XML from a recordset, the node ... will still be referencing the original image name and not the thumbnail, which...

              a) sits in the "thumbnails" subfolder, and
              b) gets the "WxH" added to the filename, e.g. imagename_100x50.jpg or whatever

              It´s certainly easy to add "thumbnails/" to the XM node as static value, e.g. thumbnails/imagename_from_recordset_here_ -- but I wonder how on earth someone can add the thumbnail´s "WxH" part in between.

              Maybe some PHP based preprocessing of the recordset´s column value, e.g. a str_replace or whatever ?

              Cheers,
              Günter Schenk
              Adobe Community Expert, Dreamweaver
              • 4. Re: show thumbnail with spry
                Level 1
                Hi Günter,

                >wow, that is one of the greatest suggestions I read since a long time

                Man, I'll print your post and show to my kid :)

                >Maybe some PHP based preprocessing of the recordset´s column value, e.g. a str_replace or whatever ?

                I solve this issue using the getimagesize() function and adding the size to the file name using substr():

                list($img_width, $img_height, $img_type, $img_attr) = getimagesize("../GalleryFolderName/" . $row_detail2imagens['AlbumField'] . "/" . $row_detail2imagens['FileField']);
                list($thumb_width, $thumb_height, $thumb_type, $thumb_attr) = getimagesize("../GalleryFolderName/" . $row_detail2imagens['AlbumField'] . "/thumbnails/" . substr($row_detail2imagens['FileField'], 0, -4) . "_140x105" . substr($row_detail2imagens['FielField'], -4));
                $thumb_width = ($thumb_width / 10) * 7;
                $thumb_height = ($thumb_height / 10) * 7;

                This generates the code for thumbnails section of my xml. Notice that $thumb_width and &thumb_height are set to 70% of the actual file size. This makes the Spry thumbs to grow onmouseover.

                It is also important to notice is needed to use a nested loop to sort the images per albums.

                Cheers!

                Marcell
                • 5. Re: show thumbnail with spry
                  Level 1
                  Thank you Günter and Marcell for thinking with me.
                  I will try the above solution and look if I can make it work.

                  Günther: Is it possible to save the thumbnails without the "WxH" added?

                  Kees.
                  • 6. Re: show thumbnail with spry
                    Günter Schenk Level 4
                    ----
                    Günther: Is it possible to save the thumbnails without the "WxH" added?
                    ----

                    Yes :-)

                    Cheers,
                    Günter Schenk
                    Adobe Community Expert, Dreamweaver
                    • 7. Re: show thumbnail with spry
                      Hi,

                      I'm facing the same problem as Kees describes above.

                      According to Günter it's possible to save the thumbs without the "_WxH" addition. This would really get me out of trouble.

                      So the question is: how to NOT get the width and height added to the thumbnailname?

                      Any help is seriously appreciated!

                      Thanks in advance.
                      Fritsie
                      • 8. Re: show thumbnail with spry
                        Level 1
                        Anyone got an idea for this? I'm pretty desperate because I can't think of a solution and I'm a bit of a noob when it comes to javascripting.

                        TIA
                        Fritsie
                        • 9. Re: show thumbnail with spry
                          Günter Schenk Level 4
                          Hi Fritsie,

                          please see the thread "How to keep original file name for thumbnails?" on the Interakt forums which provides a solution: http://www.interaktonline.com/Products/Dreamweaver-Extensions/MXFileUpload/Product-Forum/ Details/112846/How+to+keep+original+file+name+for+thumbnails%3F.html

                          Cheers,
                          Günter Schenk
                          Adobe Community Expert, Dreamweaver
                          • 10. Re: show thumbnail with spry
                            Level 1
                            Hi Günter,

                            Thanks for your reply. It didn't cross my mind to check that forum as well. I'll go check it out.

                            Thanks for the pointer!

                            Fritsie