Alpha Software Mobile Development Tools:   Alpha Anywhere    |   Alpha TransForm subscribe to our YouTube Channel  Follow Us on LinkedIn  Follow Us on Twitter  Follow Us on Facebook

Announcement

Collapse

The Alpha Software Forum Participation Guidelines

The Alpha Software Forum is a free forum created for Alpha Software Developer Community to ask for help, exchange ideas, and share solutions. Alpha Software strives to create an environment where all members of the community can feel safe to participate. In order to ensure the Alpha Software Forum is a place where all feel welcome, forum participants are expected to behave as follows:
  • Be professional in your conduct
  • Be kind to others
  • Be constructive when giving feedback
  • Be open to new ideas and suggestions
  • Stay on topic


Be sure all comments and threads you post are respectful. Posts that contain any of the following content will be considered a violation of your agreement as a member of the Alpha Software Forum Community and will be moderated:
  • Spam.
  • Vulgar language.
  • Quotes from private conversations without permission, including pricing and other sales related discussions.
  • Personal attacks, insults, or subtle put-downs.
  • Harassment, bullying, threatening, mocking, shaming, or deriding anyone.
  • Sexist, racist, homophobic, transphobic, ableist, or otherwise discriminatory jokes and language.
  • Sexually explicit or violent material, links, or language.
  • Pirated, hacked, or copyright-infringing material.
  • Encouraging of others to engage in the above behaviors.


If a thread or post is found to contain any of the content outlined above, a moderator may choose to take one of the following actions:
  • Remove the Post or Thread - the content is removed from the forum.
  • Place the User in Moderation - all posts and new threads must be approved by a moderator before they are posted.
  • Temporarily Ban the User - user is banned from forum for a period of time.
  • Permanently Ban the User - user is permanently banned from the forum.


Moderators may also rename posts and threads if they are too generic or do not property reflect the content.

Moderators may move threads if they have been posted in the incorrect forum.

Threads/Posts questioning specific moderator decisions or actions (such as "why was a user banned?") are not allowed and will be removed.

The owners of Alpha Software Corporation (Forum Owner) reserve the right to remove, edit, move, or close any thread for any reason; or ban any forum member without notice, reason, or explanation.

Community members are encouraged to click the "Report Post" icon in the lower left of a given post if they feel the post is in violation of the rules. This will alert the Moderators to take a look.

Alpha Software Corporation may amend the guidelines from time to time and may also vary the procedures it sets out where appropriate in a particular case. Your agreement to comply with the guidelines will be deemed agreement to any changes to it.



Bonus TIPS for Successful Posting

Try a Search First
It is highly recommended that a Search be done on your topic before posting, as many questions have been answered in prior posts. As with any search engine, the shorter the search term, the more "hits" will be returned, but the more specific the search term is, the greater the relevance of those "hits". Searching for "table" might well return every message on the board while "tablesum" would greatly restrict the number of messages returned.

When you do post
First, make sure you are posting your question in the correct forum. For example, if you post an issue regarding Desktop applications on the Mobile & Browser Applications board , not only will your question not be seen by the appropriate audience, it may also be removed or relocated.

The more detail you provide about your problem or question, the more likely someone is to understand your request and be able to help. A sample database with a minimum of records (and its support files, zipped together) will make it much easier to diagnose issues with your application. Screen shots of error messages are especially helpful.

When explaining how to reproduce your problem, please be as detailed as possible. Describe every step, click-by-click and keypress-by-keypress. Otherwise when others try to duplicate your problem, they may do something slightly different and end up with different results.

A note about attachments
You may only attach one file to each message. Attachment file size is limited to 2MB. If you need to include several files, you may do so by zipping them into a single archive.

If you forgot to attach your files to your post, please do NOT create a new thread. Instead, reply to your original message and attach the file there.

When attaching screen shots, it is best to attach an image file (.BMP, .JPG, .GIF, .PNG, etc.) or a zip file of several images, as opposed to a Word document containing the screen shots. Because Word documents are prone to viruses, many message board users will not open your Word file, therefore limiting their ability to help you.

Similarly, if you are uploading a zipped archive, you should simply create a .ZIP file and not a self-extracting .EXE as many users will not run your EXE file.
See more
See less

Automatically create thumbs on image upload

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Automatically create thumbs on image upload

    Is anyone automatically creating thumbs when uploading an image so that the folder can be used with the image gallery component?

    Would like this to be transparent to the user, i.e. you select an image file for upload and it gets stored as a fullsize image in the folder and a thumb sized image in the thumb folder with the same name.

    #2
    Re: Automatically create thumbs on image upload

    How's your Xbasic, Gordon?

    I believe you'll need to use the File Upload - User Defined Action Script, and then run an Xbasic function on the uploaded image(s). The Xbasic function prototype gives you everything you need to work with the images.

    To get the thumbnail you could use ImageMagick, which would need to be installed on the server. A5 has built-in ImageMagick commands.

    Is that enough to get you started?

    Comment


      #3
      Re: Automatically create thumbs on image upload

      Thanks David...

      Always up for a challenge! Although my X-basic skills are, shall we say "basic" (My background is using Delphi), it doesn't sound too daunting!

      I'll give it a go, and see what happens... Thanks for heading me in the right direction.

      Comment


        #4
        Re: Automatically create thumbs on image upload

        Turns out this wasn't really too bad afterall.
        Here's what is working for me:
        Code:
        function createthumb as v (e as p)
        'This function is called when the uploaded image data is saved to a record in the Grid.
        'A possible use of this function would be to save a thumbnail of the uploaded image in another field in the current record.
        
        'Request - The Request object. Includes Request.Variables, which should be used instead of the older e.rv construct
        'Session - The Session object. Should be used instead of the older e.session construct
        
        'The e object that is passed in contains:
        'e.tmpl  - the Grid definition
        'e.rtc - a pointer variable that is passed to all server side events
        'e.__si - state information
        'e.ops = misc properties that were defined in the builder for the image upload action
        'e.tableType - 'SQL' or 'DBF'
        'e.tempImageFilenameOnServer - temporary file in the session folder where the uploaded image was stored
        
        'If the Grid is based on a SQL database (e.tableType = 'SQL'), then e contains:
        'e.cn - a pointer to an open connection to the database
        'e.args - the sql::arguments object that contains the data that was passed to the query that saved the data
        'e.targetFieldType - the data type of the field in which the image is stored ('C' - character or  'B' - binary)
        'e.embeddedImageFormat - in the case where the image is embedded, the format (jpg or bmp) that the image was converted to before it was stored in the table
        
        'If the Grid is based on a DBF database (e.tableType = 'DBF'), then e contains:
        'e.targetFieldType - the data type of the field in which the image is stored ('I' - image file ref, 'C' - character,  'J' - jpeg, or 'B' - bmp)
        'e.tbl = tbl - pointer to the open table in which the uploaded imaged was stored - DO NOT CLOSE THIS TABLE!!.
        
        'e.imageFilenameOnServer - if the image was linked (i.e. stored in a Character field or Image File Ref Field (dbf only)), the full filename of the image file on the server. This property if blank if the image is embedded.
        'e.imageBlob - if the image is embedded, the binary image data (after it has been converted to the required type)
        'e.valueStoredInField - if the image was linked (i.e. stored in a Character or Image File Ref Field (dbf only) ), the actual filename (after it has been transformed) that was stored in the character field.
        	
        dim result as p
        dim file as c
        dim path as c
        dim fname as c
        file = e.imageFilenameOnServer
        path = file.filename_parse(file,"dp")
        fname = file.filename_parse(file,"ne")
        
        
         result = a5_runimagemagiccommand(e.imageFilenameOnServer,path+"thumbs\\"+fname,"-resize x150" )
        
        
        end function
        This allows me to insert a smaller thumbnail image into a subdirectory of "images" called "\thumbs" all in one step.

        I call this from the "On Save" server side event of the Upload Image Action Javascript "on click" function.

        Comment


          #5
          Re: Automatically create thumbs on image upload

          That'll do it... nice.

          Comment


            #6
            Re: Automatically create thumbs on image upload

            This feature is now included in V12.

            http://www.youtube.com/watch?v=fpErt...em-uploademail
            Last edited by mastermind315; 05-03-2013, 11:17 AM.

            Comment


              #7
              Re: Automatically create thumbs on image upload

              Thanks Elliot. Looks like a very nice addition to the toolbox...

              Comment


                #8
                Re: Automatically create thumbs on image upload

                Follow up question for the development team. Using the V12 release, I am successful at creating the thumbnail. But....I would like an easy method for adding a unique identifier to the image. For example, I want to create an avatar for a user. So I want to use the users unique id from the database to "map" the user to the saved file. It would be great if you could add the ability in the Transformation Expression to add any of the fields from the current dialog. It could use the {...} syntax to add the unique identifier to the file name for saving to the folder.thumbnail.jpg

                Comment


                  #9
                  Re: Automatically create thumbs on image upload

                  Hey Dion, you should post this question in the Beta Version 12 section... but since you're here...

                  Are you using the Image Upload action on a UX? And, is it Mobile?

                  David

                  Comment


                    #10
                    Re: Automatically create thumbs on image upload

                    I am using the Image Upload action in my UX component.
                    It is not mobile. I am enclosing a snapshot of the dialog.imageupload.png

                    Comment


                      #11
                      Re: Automatically create thumbs on image upload

                      V12 does include the thumbnail feature, but it adds a suffix to it like _thumbnail. Even if you leave the suffix field blank, it still adds the "_" character to the end. like filename_.jpg. Thus, the Image Gallery component will not see these because the original file and matching thumbnail do not have the exact same name.

                      Anyone figured a way around this yet?

                      Comment


                        #12
                        Re: Automatically create thumbs on image upload

                        David,

                        The latest release of Alpha Anywhere solves this. Thanks to Selwyn... if there is no suffix provided and the file does not already exist, then the thumbnail will be saved as the original upload filename. If the filename does exist then an "_" is appended to the filename so an overwrite does not happen.

                        David

                        Comment


                          #13
                          Re: Automatically create thumbs on image upload

                          Thanks David. Got that info from Selwyn. I emailed him about it and he was gracious enough to make sure that was updated. I guess I should have updated this thread. But thanks for letting me know.

                          Comment


                            #14
                            Re: Automatically create thumbs on image upload

                            Yes, that was a good change. Now the Image Upload and Image Gallery Component work beautifully together.

                            Comment

                            Working...
                            X