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

Displaying Images in custom field (source is outside webroot folder)

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

    Displaying Images in custom field (source is outside webroot folder)

    In spite of all the discussion on this topic, I can't make this work. My path data is coming from mySQL tables, and my images are stored outside of the webroot folder. Here is an example of the path in one of the records: "C:\Users\Administrator\Documents\RepoManager\Images\STR100923212544\100_3516.JPG"

    The following code is in the custom field:
    Code:
    dim vHTML as c
    dim imgblob as b
    dim filename as c
    dim sessfile as c
    
    imgblob = file.to_blob(alltrim(data.image))
    filename = file.filename_parse(alltrim(data.image),"ne")
    sessfile = session.session_folder+filename
    file.From_blob(sessfile,imgblob)
    
    vHTML = "<img src=\"data:image/jpeg;base64,"+sessfile+"\" width=\"120\" height=\"107\" />"
    IMAGE_render = vHTML
    My code copies the image file into the session_folder sucessfully, and the resulting page apparently is attempting to display the image (because the red x is displayed).

    One more thing... as I am using a live developement machine, I am publishing to localhost (may or may not be causing the problem???).

    BTW, these images display perfectly when the control type is set to image and the Display format is set to <Image File Reference Field>

    Please help, I've spent the better part of two days trying to get this to work.

    #2
    Re: Displaying Images in custom field (source is outside webroot folder)

    Hey - the new kid might be able to help! I was bailed on exactly this issue by the nice people at Alpha Five. People had suggested Custom Fields to me, but I couldn't even find where to do that, and I could follow the directions to do this. I can't describe it in words, but pictures I can do:
    calcfield.png

    settings_for_link.png
    link.png

    Well, at least I think it's a similar issue - my images are in a grid for a variety of reasons, one being I couldn't access them outside the a5webroot any other way.

    and oops - that should say "all options ... available"

    And not necessarily obvious, Image field is set to Hide
    Last edited by WendyWelton; 05-03-2011, 05:35 PM. Reason: more clarity
    Wendy Welton
    Architect
    past & future Alphaholic - deliberately falling off the wagon!

    http://www.artformhomeplans.com/

    Comment


      #3
      Re: Displaying Images in custom field (source is outside webroot folder)

      Try this

      dim vHTML as c
      dim imgblob as b

      imgblob = file.to_blob(alltrim(data.image))
      imgblob=base64encode(imgblob)

      vHTML = "<img src=\"data:image/jpeg;base64,"+imgblob+"\" width=\"120\" height=\"107\" />"
      IMAGE_render = vHTML

      Are all your images jpeg/jpg?
      If not - you will need to store the mime type as well
      Scott Moniz - Computer Programmer/Analyst
      REA Inc.
      http://reainc.net
      (416)-533-3777
      [email protected]

      REA INC offers consulting services, programming services, systems design, database design, third party payment gateway integration (CHASE, PAYPAL, AUTHORIZE.NET) and developer support.
      If you need custom code, or 1-to-1 mentoring in any facet of your database/web application design,
      contact us to discuss options.

      Comment


        #4
        Re: Displaying Images in custom field (source is outside webroot folder)

        That wont work.
        Heres what will

        test.a5w
        Code:
        <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
        <html>
        <head>
        <meta name="generator" content="Alpha Five HTML Editor Version 10 Build 3641-3625">
        <!-- must use in order to make XP Themes render -->
        <meta HTTP-EQUIV="MSThemeCompatible" content="Yes" />
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> 
        
        <title></title>
        </head>
        <body>
        <%a5 
        	?"<img src=\"test2.a5w\"/>"
        %>
        
        
        </body></html>
        test2.a5w
        Code:
        <%a5
        dim image_blob as B
            image_blob=file.to_blob("c:/test.jpg")
        ?image_blob
        %>
        Scott Moniz - Computer Programmer/Analyst
        REA Inc.
        http://reainc.net
        (416)-533-3777
        [email protected]

        REA INC offers consulting services, programming services, systems design, database design, third party payment gateway integration (CHASE, PAYPAL, AUTHORIZE.NET) and developer support.
        If you need custom code, or 1-to-1 mentoring in any facet of your database/web application design,
        contact us to discuss options.

        Comment


          #5
          Re: Displaying Images in custom field (source is outside webroot folder)

          Originally posted by aburningflame View Post
          Try this

          dim vHTML as c
          dim imgblob as b

          imgblob = file.to_blob(alltrim(data.image))
          imgblob=base64encode(imgblob)

          vHTML = "<img src=\"data:image/jpeg;base64,"+imgblob+"\" width=\"120\" height=\"107\" />"
          IMAGE_render = vHTML

          Are all your images jpeg/jpg?
          If not - you will need to store the mime type as well

          vHTML = "<img src=\"myimageserver.a5w?img="+data.image+"\" width=\"120\" height=\"107\" />"
          IMAGE_render = vHTML


          myimageserver.a5w
          if eval_valid("Request.Variables.img") then
          ?file.to_blob(Request.Variables.img)
          end if



          ANyways - you get the point.
          Cleanse your variables and make sure theyre good.
          Scott Moniz - Computer Programmer/Analyst
          REA Inc.
          http://reainc.net
          (416)-533-3777
          [email protected]

          REA INC offers consulting services, programming services, systems design, database design, third party payment gateway integration (CHASE, PAYPAL, AUTHORIZE.NET) and developer support.
          If you need custom code, or 1-to-1 mentoring in any facet of your database/web application design,
          contact us to discuss options.

          Comment


            #6
            Re: Displaying Images in custom field (source is outside webroot folder)

            Thanks for your feeback Wendy. I became familiar with your approach by looking at the your posts/threads on the topic. My issues is that I need to use the custom control type. I need to add more html markup than I'm showing at the moment. I appreciate you taking the time to reply though. Your posts and questions have been helpful to me as well.

            Comment


              #7
              Re: Displaying Images in custom field (source is outside webroot folder)

              Scott, I've also seen your postings on the topic, and give it a show earlier. Before, my issue was that the grid was returning a unique image for every record. I didn't see how to do that on earlier posts. However, I can see it in your last post.

              I've tried your recommendation and got same result, but there could be other issues causing the problem. Here's my shot at your approach:

              The grid with the custom field, code in the custom field:
              Code:
              dim vImg as c
              vImg = alltrim(data.image)
              vHTML = "<img src=\"showimage.a5w?image="+vImg+"\" width=\"120\" height=\"107\" />"
              IMAGE_render = vHTML
              The showimage.a5w page:
              Code:
              <!doctype html public "-//w3c//dtd html 4.0 transitional//en">
              <html><head>
              <meta content="text/html; charset=unicode" http-equiv=Content-Type>
              <%a5
              if eval_valid("Request.Variables.image") then
                  ?file.to_blob(Request.Variables.image)
              %>
              <meta name=GENERATOR content="MSHTML 8.00.6001.19048"></head>
              <body></body></html>
              The good news is that each of the images represented by the red x has a different file source. So the filter is working.

              FYI - I right-clicked and got the properties of one of the images (red x's). Here's what I got:
              showimage.a5w?image=C:\Users\Administrator\Documents\RepoManager\Images\STR100923212544\100_3517.JPG
              This is the image I'm looking for, its just not rendering properly on the page. The attachment is a snip of the result.

              Capture.GIF

              Comment


                #8
                Re: Displaying Images in custom field (source is outside webroot folder)

                By the way, I caught and fixed the missing "end if" in the last illustration. Still doesn't work.

                Comment


                  #9
                  Re: Displaying Images in custom field (source is outside webroot folder)

                  oh thank you. I expect it will be awhile before I'm ACTUALLY useful!
                  Wendy Welton
                  Architect
                  past & future Alphaholic - deliberately falling off the wagon!

                  http://www.artformhomeplans.com/

                  Comment


                    #10
                    Re: Displaying Images in custom field (source is outside webroot folder)

                    <!doctype html public "-//w3c//dtd html 4.0 transitional//en">
                    <html><head>
                    <meta content="text/html; charset=unicode" http-equiv=Content-Type>
                    <%a5
                    if eval_valid("Request.Variables.image") then
                    ?file.to_blob(Request.Variables.image)
                    %>
                    <meta name=GENERATOR content="MSHTML 8.00.6001.19048"></head>
                    <body></body></html>


                    My example does not show any html markup. Your tags are screwing up the image delivery.
                    Your page should be this and only this:
                    <%a5
                    if eval_valid("Request.Variables.image") then
                    ?file.to_blob(Request.Variables.image)
                    end if
                    %>
                    Scott Moniz - Computer Programmer/Analyst
                    REA Inc.
                    http://reainc.net
                    (416)-533-3777
                    [email protected]

                    REA INC offers consulting services, programming services, systems design, database design, third party payment gateway integration (CHASE, PAYPAL, AUTHORIZE.NET) and developer support.
                    If you need custom code, or 1-to-1 mentoring in any facet of your database/web application design,
                    contact us to discuss options.

                    Comment


                      #11
                      Re: Displaying Images in custom field (source is outside webroot folder)

                      Double Post sorry - damn forum :)
                      Scott Moniz - Computer Programmer/Analyst
                      REA Inc.
                      http://reainc.net
                      (416)-533-3777
                      [email protected]

                      REA INC offers consulting services, programming services, systems design, database design, third party payment gateway integration (CHASE, PAYPAL, AUTHORIZE.NET) and developer support.
                      If you need custom code, or 1-to-1 mentoring in any facet of your database/web application design,
                      contact us to discuss options.

                      Comment


                        #12
                        Re: Displaying Images in custom field (source is outside webroot folder)

                        As I learn...

                        Scott,

                        Can he or should he then put any html markup outside that code on his web page? Even though I'm generating my images in a different way in the grid, what I insert into a web pages is the same type of <A5% etc. I've directly added float and such to a Div that encloses the <A5% code. And I've also succeeded in controlling the size of the grid component in it's entirety through both CSS and height and width in the div.

                        Mstricky,

                        I recognize height, width etc. What does the "session" part do?
                        Wendy Welton
                        Architect
                        past & future Alphaholic - deliberately falling off the wagon!

                        http://www.artformhomeplans.com/

                        Comment


                          #13
                          Re: Displaying Images in custom field (source is outside webroot folder)

                          Hey Wendy. In researching this problem over the last couple of days, I learned that you cannot view an image that does not reside in the web root or project folder. Therefore, the methodology that I was trying would grab a binary file from outside of the webroot
                          Code:
                          imgblob = file.to_blob(alltrim(data.image))
                          then save it to the session_folders folder in the webroot. I was using the file.from_blob to save the file into the session_folders folder in the webroot. The session_folders folder is emptied of the related session (which is a subfolder of the session_folders folder) when the session ends, so there's no cleanup to do.

                          Comment


                            #14
                            Re: Displaying Images in custom field (source is outside webroot folder)

                            Thanks Scott. My first attempt at this didn't have any html markup. However, I didn't realize that moving from the "Source" tab to the "WYSIWYG" tab in the HTML editor will insert the markup. When I later saw the markup, I thought there was no way to prevent. But, if you save and publish from the source tap, the markup is not inserted (I think).

                            Unfortunately, I have another problem today that is very alarming, as you might have noticed in another post. The system is creating (adding) multiple session folders every time the page refreshes.

                            Comment


                              #15
                              Re: Displaying Images in custom field (source is outside webroot folder)

                              M,

                              What's your name?

                              Aha! So you're chewing on exactly the problem I ran into which lead me to put my images in a grid, where I could access them from the data folder, not the web root. I'll be interested to see the final solution, because any that were offered to me were beyond my capability. I believe I also heard that there's a fix coming that will make Aliases work correctly, allowing images to be accessed from outside the web root.

                              btw - using grids works nicely, got them to be full bleed, no "grid" visible whatsoever - EXCEPT, I haven't yet succeeded in have words wrap around them on a web page, like we can do with any image that's not grid delivered. But, I'm not done hunting yet.
                              Wendy Welton
                              Architect
                              past & future Alphaholic - deliberately falling off the wagon!

                              http://www.artformhomeplans.com/

                              Comment

                              Working...
                              X