7 Replies Latest reply on Jun 5, 2010 9:32 PM by Ted Daniels

    Image Resize in CF 8

    Karen_Little Level 1

      I'm working in CF 8. My issue is that my image cannot be taller than T nor wider than W.

       

      I assume that I need to perform a number of tests on the uploaded image's height and width to come up with the optimum size, then plug those two measurements in pixels into Image Resize.

       

      In other words, if the image is taller than T, reduce W by a related %. If the new width is still wider than the required W, reduce the width accordingly, then reduce the height by a related %. When done, plug those two numbers into Image Resize.

       

      Is there any other way to do this, or is my interpretation of the required steps correct?

       

      Thanks, Karen

        • 1. Re: Image Resize in CF 8
          Ted Daniels Level 1

          Use CFX_OpenImage. I use it all the time for Resizing, Cropping and Rotating on the fly - it is fast and very flexible. You'll have to Google it. It was written, I believe, by somone in Finland. If you can't find it let me know and I'll email it to you.

           

          Ted Daniels (ted_daniels@hotmail.com)

          • 2. Re: Image Resize in CF 8
            Karen_Little Level 1

            Ted, I'll look that up. Note that I was successfully using an image manipulation program  written by www.masrizal.com which worked like a champ until CF was upgraded to version 8.

             

            So now I am writing my own routine, which, as of 2PM today, I more or less successfully did.

             

            Where I do not think I'm successful is this - please advise:

             

            I need to rename my file and end that renamed file with a file extension. Right now, I am forcing that extension to be ".jpg".

             

            I believe that what I really need to do is figure out what type of image file was uploaded and if not a .jpg, convert it to a .jpg, or use the same file extension.

             

            In CF8's documentation, I see a reference to image file convert, but its paramaters make no sense.

             

            The online docs don't appear to address the issue of evaluating what type of image was uploaded and what type of image that has to be converted to.

             

            If anyone could shed light on this, I'd be most greatful.

             

            Karen

            • 3. Re: Image Resize in CF 8
              Ted Daniels Level 1

              Karen:

               

               

               

              Try the CFX_OpenImage first (Its free) - I don't recall all its functionality, just know what I use it for. I originally tried  but it was dreadfully slow compared with CFX_OpenImage.

               

               

               

              I'm just doing some programming to store images directly into an SQL database - stupid idea, but I have to convert a large database with neat ideas into another large database filled with stupid ideas, storing images directly in an Image Field being one of them.

               

               

               

              Not only was it a stupid idea they had, but they were betting I couldn't do it because I store all my images in directories and just store the path in the database. Well, just took 2 hrs to figure it out this morning - ha ha

               

               

               

              Anyway, I'll look at your stuff later today after I have polished up what I am doing now.

               

               

               

              Ted

               

               

               

               

               

              Date: Sat, 5 Jun 2010 12:08:52 -0600

              From: forums@adobe.com

              To: ted_daniels@hotmail.com

              Subject: Image Resize in CF 8

               

              Ted, I'll look that up. Note that I was successfully using an image manipulation program  written by http://www.masrizal.com which worked like a champ until CF was upgraded to version 8.

               

              So now I am writing my own routine, which, as of 2PM today, I more or less successfully did.

               

              Where I do not think I'm successful is this - please advise:

               

              I need to rename my file and end that renamed file with a file extension. Right now, I am forcing that extension to be ".jpg".

               

              I believe that what I really need to do is figure out what type of image file was uploaded and if not a .jpg, convert it to a .jpg, or use the same file extension.

               

              In CF8's documentation, I see a reference to image file convert, but its paramaters make no sense.

               

              The online docs don't appear to address the issue of evaluating what type of image was uploaded and what type of image that has to be converted to.

               

              If anyone could shed light on this, I'd be most greatful.

               

              Karen

              >

              1 person found this helpful
              • 4. Re: Image Resize in CF 8
                Karen_Little Level 1

                Ted - that is a really stupid idea. Storing images in a database? Oh well, at least you know how to do it.

                 

                I just successfully finished my own version of image upload and manipulation and have another, unrelated area to debug before going live.

                 

                Documentation for the image upload tag, ver cf8, is the pits. If I get some time, I might freshen it up a bit.

                 

                After all my current anxiety has subsided, I'll try CFX_OpenImage - http://www.kolumbus.fi/jukka.manner/cfx_openimage/

                 

                According to the page, the latest version is 1.4.1, May 14, 2010, which is good. But if it relies of CF9, everyone without it is screwed.

                 

                As I said before this weekend, the routine used, which was based on JAVA and worked just fine in CFMX, did not work in CF8. That makes me hesitate to want to depend on a 3rd party app if Adobe is busy changing CF.

                 

                I did come up with a pretty good system of reusable image handling code and I did find the answer to the question, "what file extension to use" after pondering the concept for an hour and a half. Also, in the file upload tag, I remember that originally (several years ago) I had to  search far and wide to find the accepted file types, which in my case are:


                    accept = "image/pjpeg, image/jpg, image/jpeg, image/gif, image/x-png"

                 

                I first started this project a few years ago, and just got back into it last night. My original code related to ACCEPT successfully displays a message when the user uploads the wrong type. To tidy things up, I edited what I had in ACCEPT by eliminating "pjpeg" and "x-png" and it failed. I have no idea why, so I put returned the original declarations and now, all is good.

                 

                I really do need to clarify some stuff on the Image Upload online docs, but I guess my pearls of wisdom would be lost on CF9 . . .

                 

                Karen

                • 5. Re: Image Resize in CF 8
                  Ted Daniels Level 1

                  Karen:

                   

                   

                   

                  Yes, finally got the images stored directly in the database and read them back and displayed in a web page.

                   

                   

                   

                  I do a lot of document scanning, resizing, cropping, rotating and displaying, all on the fly.

                   

                   

                   

                  One application is for Jury Slection. Once I get a Jury Pool List I first generate the Juror Summonses, with and generate a barcode related to the JurorID and print it on the summons, along with Juror information. Then, when the juror shows up in court, we scan the barcode with a handheld scanner, then scan the whole document, which is two sided,  through a sheet feed scanner. The scan operation takes place entirely within the web page and it totally integrated with the browser based application. Then withinin about .25 secs, I have to strip out (crop) the questionnaire section which is half of one side, scale it and rotate it so I can fit three to a legal size paper, so I can give the Judge and Attorneys a composite of all the Questionnaires.

                   

                   

                   

                  I do a very similar operation for Mail-in Ballot Applications for elections as we track and compare signatures etc on every main-in ballot application so we can trap fraudulent apps.

                   

                   

                   

                  Everything is done thru the web browser, which makes the system very flexible.

                   

                   

                   

                  I scan the docs as PNG graphics and of course do the crop/rotate/resize on the PNG file.

                   

                   

                   

                  I use CFX_OpenImage in CF7 and CF8, but have not tried it in CF9, because I don't have it. So if the latest version requires CF9, I can let you have my version which works fine in CF7 and CF8.

                   

                   

                   

                  Don't ley your anxiety levels get high, that just stops you thinking. I used to get sweaty palms and my eyes would glaze over when I came across problems I had no idea how to resolve. Over time I have come to realize even the most intractable problems can be resolved in a couple of days, if you don't panic

                   

                   

                   

                  Ted

                   

                   

                   

                   

                   

                  Date: Sat, 5 Jun 2010 13:59:19 -0600

                  From: forums@adobe.com

                  To: ted_daniels@hotmail.com

                  Subject: Image Resize in CF 8

                   

                  Ted - that is a really stupid idea. Storing images in a database? Oh well, at least you know how to do it.

                   

                  I just successfully finished my own version of image upload and manipulation and have another, unrelated area to debug before going live.

                   

                  Documentation for the image upload tag, ver cf8, is the pits. If I get some time, I might freshen it up a bit.

                   

                  After all my current anxiety has subsided, I'll try CFX_OpenImage - http://www.kolumbus.fi/jukka.manner/cfx_openimage/

                   

                  According to the page, the latest version is 1.4.1, May 14, 2010, which is good. But if it relies of CF9, everyone without it is screwed.

                   

                  As I said before this weekend, the routine used, which was based on JAVA and worked just fine in CFMX, did not work in CF8. That makes me hesitate to want to depend on a 3rd party app if Adobe is busy changing CF.

                   

                  I did come up with a pretty good system of reusable image handling code and I did find the answer to the question, "what file extension to use" after pondering the concept for an hour and a half. Also, in the file upload tag, I remember that originally (several years ago) I had to  search far and wide to find the accepted file types, which in my case are:

                   

                      accept = "image/pjpeg, image/jpg, image/jpeg, image/gif, image/x-png"

                   

                  I first started this project a few years ago, and just got back into it last night. My original code related to ACCEPT successfully displays a message when the user uploads the wrong type. To tidy things up, I edited what I had in ACCEPT by eliminating "pjpeg" and "x-png" and it failed. I have no idea why, so I put returned the original declarations and now, all is good.

                   

                  I really do need to clarify some stuff on the Image Upload online docs, but I guess my pearls of wisdom would be lost on CF9 . . .

                   

                  Karen

                  >

                  • 6. Re: Image Resize in CF 8
                    Karen_Little Level 1

                    Thanks, Ted. And I fixed my image problems, too!

                    • 7. Re: Image Resize in CF 8
                      Ted Daniels Level 1

                      Karen:

                       

                       

                       

                      I'm sure your image is impeccible and untarnished.

                       

                       

                       

                      Now if only we could all fix our images with CF8!

                       

                       

                       

                      Ted

                       

                      Date: Sat, 5 Jun 2010 22:26:42 -0600

                      From: forums@adobe.com

                      To: ted_daniels@hotmail.com

                      Subject: Image Resize in CF 8

                       

                      Thanks, Ted. And I fixed my image problems, too!

                      >