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

Adding picture or images jpg

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

  • Adding picture or images jpg

    I am trying to add many pictures.
    The process takes a long time adding one at a time.
    I need to select a picture, but 1 out of a bunch of them.
    Now It requires to many clicks to reach the folder and change from bmp to jpg.

    Db name is Boxes.dbf
    The location is c:\box
    Pictures are in c:\box\images

    I saw this thread http://msgboard.alphasoftware.com/al...dding+pictures

    I tried both of scripts but I got errors:
    =================================
    This Script 1 : give expected value error

    tbl=table.open(A_DB_CURRENT_PATH+"Box.DBF")
    path1 = ui_get_path ("Enter Path","", "c:")
    list = filefind.get(path1+chr(92)+"*.jpg",35,"N|c|L")
    format = "name|creation|size"
    dim pp[2000] as p
    count = w_count(list,crlf())
    ' lines=count
    trace.writeln(str(count))
    pp.initialize_properties(format,list)
    dim indx as n
    indx = 1
    dim a_files[count] as p
    for i = 1 to count

    f=file.open(path1+pp[i].name,file_ro_shared)
    temp = ui_bitmap_load("temp",f.readb(val(pp[i].size)))
    f.close()

    results = ui_dlg_box(pp[i].name,
    %dlg%)
    ui_bitmap_drop("temp")
    if results = "Next" then
    goto nexti
    else if results = "Cancel" then
    tbl.close()
    end
    else if results = "Add" then
    end if

    if count = 0 then
    goto allend
    else
    trace.writeln(path1+pp[i].name+" "+pp[i].creation+" " +pp[i].size)
    tbl=table.current(2)
    if tbl.mode_get()
    ========================================================

    Script 2 gives : extra character at end of expression error
    and refers to line 4

    a5_get_jpeg(jpeg1.this)
    function a5_get_jpeg as v(obj as p)
    result = ui_get_image_filename("")
    if result "" "" then
    dim data as b
    f = file.open(result,FILE_RO_SHARED)
    data = f.readb(f.bytes_get())
    f.close()
    if right(result,4) = ".BMP" then
    data = bitmap_to_jpeg(data)
    end if
    fld = obj.field_get()
    tbl = fld.table_get()
    if tbl.mode_get() = 0 then

    tbl.change_begin()

    fld.value_put(data)

    tbl.change_end(.t.)

    obj.parent.Resynch()
    else

    fld.value_put(data)

    obj.parent.commit()

    obj.parent.Resynch()
    end if
    end if
    end function
    Similarly, here is the code to insert a Bitmap image.
    function a5_get_bitmap as
    v(obj as p)
    result = ui_get_image_filename("")
    if result "" "" then
    dim
    data as b
    f = file.open(result,FILE_RO_SHARED)
    data = f.readb(f.bytes_get())
    f.close()
    if right(result,4) "" ".BMP" then
    data = jpeg_to_bitmap(data)
    end if
    fld = obj.field_get()
    tbl = fld.table_get()
    if tbl.mode_get() = 0 then
    tbl.change_begin()
    fld.value_put(data)
    tbl.change_end(.t.)
    obj.parent.Resynch()
    else
    fld.value_put(data)
    obj.parent.commit()
    obj.parent.Resynch()
    end if
    end if
    end function
    ==================================================

  • #2
    Re: Adding picture or images jpg

    if result "" then

    Sometimes the formatting when copying from the board to a script introduces script errors caused by special characters.

    Doug's script doesn't seem to be complete.
    There can be only one.

    Comment


    • #3
      Re: Adding picture or images jpg

      Thanks for reseponding.
      I did tried to remove the xtra "", but I still get the same error.

      Comment


      • #4
        Re: Adding picture or images jpg

        Typo in the original, should be

        if result = ""
        There can be only one.

        Comment


        • #5
          Re: Adding picture or images jpg

          The Codes above did not work properly and the results was not going to be what I want.

          I fount this Thread
          http://msgboard.alphasoftware.com/al...ghlight=images

          I have followed the instructions and I have a
          table called Product
          A field called "Picture" an image reference type
          A field called "FullpictureFile" Character that has like PICT2237.jpg for data in other words the file name of every picture
          Images that are stored in c:\Box\images

          Here is the code I am using and I get error Expected Value in line 18

          the line 18 is:
          imageName = imageFolderName + chr(92) +\evaluate_string(image_filename_template)

          The full code is here:

          dim t as p
          t = table.open("product")
          dim fn as c
          dim pathName as c
          dim image_filename_template as c
          dim imageFolderName as c
          imageFolderName = "Images"
          image_filename_template = "fullpicturefile"
          pathName = file.filename_parse(t.filename_get(),"dp")
          dim imageName as c
          t.fetch_first()
          dim totalcount as n
          totalcount = t.records_get()
          dim count as n = 0
          while .not. t.fetch_eof()
          count = count +1
          statusbar.Set_Text("Updating " + count + " of " + totalcount)
          imageName = imageFolderName + chr(92) +\evaluate_string(image_filename_template)
          if file.exists(pathName + imageName) then
          t.change_begin()
          t.Picture = imageName
          t.change_end(.t.)
          end if
          t.fetch_next()
          end while
          t.close()
          ui_msg_box("Done","Updated " + count + " records.")

          Comment


          • #6
            Re: Adding picture or images jpg

            Remove the backslash.


            Code:
            imageName = imageFolderName + chr(92) +[COLOR="Red"][SIZE="5"]\[/SIZE][/COLOR]evaluate_string(image_filename_template)
            It was probably intended as a continuation character in the original script. This is legal...

            Code:
            imageName = imageFolderName + chr(92) +\
            evaluate_string(image_filename_template)
            There can be only one.

            Comment


            • #7
              Re: Adding picture or images jpg

              Thanks, removing the slash removed the error.
              The script runs and it says that updated 6, but the images are not added.
              I must be missing some syntax.
              I am attaching the DB

              Comment


              • #8
                Re: Adding picture or images jpg

                Try it this way.

                Code:
                dim t as p
                t = table.open("product")
                dim fn as c
                dim pathName as c
                dim image_filename_template as c
                dim imageFolderName as c
                imageFolderName = "Images"
                image_filename_template = "fullpicturefile"
                pathName = file.filename_parse(t.filename_get(),"dp")
                dim imageName as c
                t.fetch_first()
                dim totalcount as n
                totalcount = t.records_get()
                dim count as n = 0
                WHILE .not. t.fetch_eof()
                	imageName = imageFolderName + chr(92) + eval("t."+image_filename_template) 
                	IF file.exists(pathName + imageName) THEN
                		count = count +1
                		statusbar.Set_Text("Updating " + count + " of " + totalcount)
                		t.change_begin()
                		t.Picture = image_filename_encode(imageName)
                		t.change_end(.t.)
                	END IF
                	t.fetch_next()
                END WHILE
                t.close()
                ui_msg_box("Done","Updated " + count + " records.")
                Last edited by Stan Mathews; 04-14-2010, 10:50 AM. Reason: changed while loop for accurate count
                There can be only one.

                Comment


                • #9
                  Re: Adding picture or images jpg

                  PERFECT !!!!!!
                  I did correct the spacing in
                  END WHILE t.close()
                  I hope others will will be able to use this code.
                  Thanks

                  Comment


                  • #10
                    Re: Adding picture or images jpg

                    All pictures are in the product table and they seem to work.
                    I just try to create a web site using that DB and all inventory is there. The pictures are not displayed.
                    It shows the proper subdirectory and the picture no.
                    If I got back and add manually the same picture, Only those will appear in the web site.
                    In other words only manual update is recognized.

                    Is there a way to globally refresh, update or reindex the pictures ?

                    I should bring this to the Server section.
                    Last edited by CarverRon; 04-19-2010, 03:20 PM.

                    Comment

                    Working...
                    X