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

Help with using API and http_fetch

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

    #16
    Re: Help with using API and http_fetch

    Attached is the UX component for this process. The List control is using a connection and a table... as is an XBasic function. The table definition can be found at the beginning of the XBasic function in the UX.

    ItemMaster returns data for a Brand, or a Search, or a UPC, and other queries. In this example we're going after a UPC list from a table. As each call is made to ItemMaster for a UPC the data for that UPC is returned in XML format which includes URLs (multiple) for product images. In this example we're just going after 1 image.

    Once we have the image URL, we do an http_get to grab that image data. Once you've got the binary data you can write it out to disk or push it out to sql.

    I feel this is an interesting example because we get to use a List control, an API, XML data, cURL, http_get, and binary image data.
    Attached Files

    Comment


      #17
      Re: Help with using API and http_fetch

      David, thanks so much for taking this on. As soon as I work with it I will report back.
      Richard Urban

      Grocery Delivery Software for Stores and Entrepreneurs: http://www.urbangrocery.com

      Comment


        #18
        Re: Help with using API and http_fetch

        Thanks again, David. This works beautifully. As I work with it I will get a much better understanding of how to work with APIs.
        Richard Urban

        Grocery Delivery Software for Stores and Entrepreneurs: http://www.urbangrocery.com

        Comment


          #19
          Re: Help with using API and http_fetch

          Here is David's code modified to save the file and to make two resized images with the a5 image magic function:
          Code:
          function getItemMaster as c (e as p)
          	
          'debug(1)
          
          'Here is the MySQL Table structure for the table used in this function
          'SET FOREIGN_KEY_CHECKS=0;
          'DROP TABLE IF EXISTS `tblitemmasterimages`;
          'CREATE TABLE `tblitemmasterimages` (
          '  `ItemId` int(10) NOT NULL AUTO_INCREMENT,
          '  `ItemUPC` varchar(20) DEFAULT NULL,
          '  `ItemDesc` varchar(255) DEFAULT NULL,
          '  `ItemImageURL` varchar(500) DEFAULT NULL,
          '  `ItemImage` longblob,
          '  PRIMARY KEY (`ItemId`)
          ') ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=latin1;
          
          
          dim cn as sql::Connection
          dim flag as l
          dim sqlStmt as c
          dim rs as sql::ResultSet
          dim args as sql::arguments
          
          flag = cn.open("::Name::urbangrocery")
          	args.set("from",e.dataSubmitted.from_code)
          	args.set("to",e.dataSubmitted.to_code)
          
          if flag then
          
          	sqlStmt = "SELECT UPC from products where new_code between :from and :to and (new_field2<>'Office' or new_field2 is null);"
          
          	flag = cn.Execute(sqlStmt,args)
          	if flag then
          		'ALL OK
          		rs = cn.ResultSet
          		myUPCList = rs.ToString()
          	else
          		'there was an error - close the connection and exit
          		cn.Close()
          		dim msg as c 
          		msg = "Could not execute the query. Error reported was: " + cn.CallResult.text
          		msg = js_escape(msg)
          		dim jscmd as c 
          		jscmd = "alert('" + msg + "');"
          		getItemMaster = jscmd
          		exit function
          	end if  
          	
          else
          	'there was an error - close the connection and exit
          	dim msg as c 
          	msg = "Could not open the connection. Error reported was: " + cn.CallResult.text
          	msg = js_escape(msg)
          	dim jscmd as c 
          	jscmd = "alert('" + msg + "');"
          	getItemMaster = jscmd
          	exit function
          end if
          
          'cn.FreeResult()
          
          
          'Set up a list of UPCs to get
          'dim myUPCList as c = <<%str%
          '012000005190
          '012000004926
          '012000008931
          '012000004995
          '078000160468
          '078000156461
          '078000152456
          '078000152463
          '078000003000
          '078000001143
          '%str%
          
          dim imURL as c
          dim imContentXML as c
          dim imContent as p
          dim imCount as n
          dim imName as c
          dim imImage as b
          
          dim flag_1 as l
          dim slist1[0] as c = [ "username:xxxxxx" , "password:xxxxxxx" ]
          dim ce as extension::Curl
          ce = extension::Curl.Init()
          ce.setOpt("NOPROGRESS",1)
          ce.setOpt("USERAGENT","curl/7.34.0")
          ce.setOpt("HTTPHEADER",slist1)
          ce.setOpt("MAXREDIRS",50)
          ce.setOpt("CAINFO",a5.Get_Exe_Path()+"\caroot\ca-cert.pem")
          ce.setOpt("CAPATH",a5.Get_Exe_Path()+"\caroot")
          'ce.setOpt("SSH_KNOWNHOSTS","C:\Users\David\AppData\Roaming/_ssh/known_hosts")
          ce.setOpt("TCP_KEEPALIVE",1)
          
          'debug(1)
          for each imItem in myUPCList
          
          	currUPC = imItem.value
          	dim cf_1 as extension::CurlFile	
          	ce.setOpt("URL","https://api.itemmaster.com/v2/item?idx=0&limit=500&upc=" + currUPC + "&epl=600&ef=jpg")	
          	ce.SetOpt("FILE",cf_1)		
          
          	flag_1 = ce.Exec()
          
          	'get the reulting xml from the call
          	imContentXML = cf_1.GetContent()
          
          	'turn the xml into something nice we can use
          	delete imContent
          	dim imContent as p
          	imContent = *property_from_xml(imContentXML,imContent) 
          	
          	imCount = imContent.items.count
          	if imCount <> 0 then
          
          		'we have data from the UPC code
          		
          		'media is an array of images.  Just grab the 1st one.  Another loop is needed to get all images for a product
          		delete imURL
          		dim imURL as c
          		imURL = imContent.items.item.media.medium.url
          		imName = imContent.items.item.name
          	
          		'The returned image url is messed up for our next call because of &amp; which is included
          		'in the returned URL - fix it.
          		imURL = stritran(imURL,"&amp;","&")
          	
          
          		'The URL is a simple http call... use http_get.  The binary image data is returned in the body
          		dim result as p
          		result = http_get(imURL)
          	
          		'The image is binary - write it out to a file... or to a table
          		imImage = result.body
          		
          		file.from_blob("C:\a5\Ver12web\tempimages\\" + currUPC + ".jpg", imImage)  
          		
          		sourceFile = "C:\a5\Ver12web\tempimages\\" + currUPC + ".jpg"
          		destinationFile = "C:\a5\Ver12web\images\\" + currUPC + ".jpg"
          		
          		a5_runImageMagicCommand(sourceFile,destinationFile,"-resize 50x50")
          		
          		destinationFile = "C:\a5\Ver12web\images\full\\" + currUPC + ".jpg"
          		a5_runImageMagicCommand(sourceFile,destinationFile,"-resize 350x350")
          		file.remove(sourceFile)
          		'Write it back out to the table
          		'debug(1)
          		
          		args.set("argsUPC",currUPC)
          		args.set("argsURL",imURL)
          		args.set("pic_url","http://ugimg.com/images/" + currUPC + ".jpg")
          				
          		sqlStmt = <<%str%
          		 	UPDATE products
          		 	set picture_ref = :argsURL, picture_url = :pic_url,new_field2 = 'Office',upload_by = 'itemmaster'
          			WHERE UPC = :argsUPC;
          			%str%
          
          		flag = cn.Execute(sqlStmt,args)
          		if flag then
          			'ALL OK
          		else
          			'there was an error - close the connection and exit
          			cn.Close()
          			dim msg as c 
          			msg = "Could not execute the query. Error reported was: " + cn.CallResult.text
          			msg = js_escape(msg)
          			dim jscmd as c 
          			jscmd = "alert('" + msg + "');"
          			getItemMaster = jscmd
          			exit function
          		end if  
          	
          	end if
          	delete cf_1
          	
          next  
          
          
          cn.close()
          ce.close()
          
          'refresh the UX List control
          'getItemMaster = "{dialog.object}.refreshListData('ItemMasterList');"
          getItemMaster = "alert('All Item Master matching items have been downloaded');"
          
          	
          	
          end function
          One problem is that once in a while there is data returned, but no image. I am not sure how to test if
          " imContent.items.item.media.medium.url" exists and then skip to the next upc in the loop. Can anyone help with that?
          Last edited by richardurban; 03-29-2015, 01:11 AM.
          Richard Urban

          Grocery Delivery Software for Stores and Entrepreneurs: http://www.urbangrocery.com

          Comment


            #20
            Re: Help with using API and http_fetch

            I have added an "on error resume" statement to ignore the error message when a picture is missing and to continue with the next item. This solves the problem of an occasional missing picture, even though there is a listing for that item:
            Code:
            function getItemMaster as c (e as p)
            	
            'debug(1)
            
            'Here is the MySQL Table structure for the table used in this function
            'SET FOREIGN_KEY_CHECKS=0;
            'DROP TABLE IF EXISTS `tblitemmasterimages`;
            'CREATE TABLE `tblitemmasterimages` (
            '  `ItemId` int(10) NOT NULL AUTO_INCREMENT,
            '  `ItemUPC` varchar(20) DEFAULT NULL,
            '  `ItemDesc` varchar(255) DEFAULT NULL,
            '  `ItemImageURL` varchar(500) DEFAULT NULL,
            '  `ItemImage` longblob,
            '  PRIMARY KEY (`ItemId`)
            ') ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=latin1;
            
            
            dim cn as sql::Connection
            dim flag as l
            dim sqlStmt as c
            dim rs as sql::ResultSet
            dim args as sql::arguments
            
            flag = cn.open("::Name::urbangrocery")
            	args.set("from",e.dataSubmitted.from_code)
            	args.set("to",e.dataSubmitted.to_code)
            
            if flag then
            
            	sqlStmt = "SELECT UPC from products where new_code between :from and :to and (new_field2<>'Office' or new_field2 is null);"
            
            	flag = cn.Execute(sqlStmt,args)
            	if flag then
            		'ALL OK
            		rs = cn.ResultSet
            		myUPCList = rs.ToString()
            	else
            		'there was an error - close the connection and exit
            		cn.Close()
            		dim msg as c 
            		msg = "Could not execute the query. Error reported was: " + cn.CallResult.text
            		msg = js_escape(msg)
            		dim jscmd as c 
            		jscmd = "alert('" + msg + "');"
            		getItemMaster = jscmd
            		exit function
            	end if  
            	
            else
            	'there was an error - close the connection and exit
            	dim msg as c 
            	msg = "Could not open the connection. Error reported was: " + cn.CallResult.text
            	msg = js_escape(msg)
            	dim jscmd as c 
            	jscmd = "alert('" + msg + "');"
            	getItemMaster = jscmd
            	exit function
            end if
            
            'cn.FreeResult()
            
            
            'Set up a list of UPCs to get
            'dim myUPCList as c = <<%str%
            '012000005190
            '012000004926
            '012000008931
            '012000004995
            '078000160468
            '078000156461
            '078000152456
            '078000152463
            '078000003000
            '078000001143
            '%str%
            
            dim imURL as c
            dim imContentXML as c
            dim imContent as p
            dim imCount as n
            dim imName as c
            dim imImage as b
            
            dim flag_1 as l
            dim slist1[0] as c = [ "username:rurban" , "password:Password1" ]
            dim ce as extension::Curl
            ce = extension::Curl.Init()
            ce.setOpt("NOPROGRESS",1)
            ce.setOpt("USERAGENT","curl/7.34.0")
            ce.setOpt("HTTPHEADER",slist1)
            ce.setOpt("MAXREDIRS",50)
            ce.setOpt("CAINFO",a5.Get_Exe_Path()+"\caroot\ca-cert.pem")
            ce.setOpt("CAPATH",a5.Get_Exe_Path()+"\caroot")
            'ce.setOpt("SSH_KNOWNHOSTS","C:\Users\David\AppData\Roaming/_ssh/known_hosts")
            ce.setOpt("TCP_KEEPALIVE",1)
            
            'debug(1)
            for each imItem in myUPCList
            
            	currUPC = imItem.value
            	dim cf_1 as extension::CurlFile	
            	ce.setOpt("URL","https://api.itemmaster.com/v2/item?idx=0&limit=500&upc=" + currUPC + "&epl=600&ef=jpg")	
            	ce.SetOpt("FILE",cf_1)		
            
            	flag_1 = ce.Exec()
            
            	'get the reulting xml from the call
            	imContentXML = cf_1.GetContent()
            
            	'turn the xml into something nice we can use
            	delete imContent
            	dim imContent as p
            	imContent = *property_from_xml(imContentXML,imContent) 
            	
            	imCount = imContent.items.count
            	if imCount <> 0 then
            
            		'we have data from the UPC code
            		
            		'media is an array of images.  Just grab the 1st one.  Another loop is needed to get all images for a product
            		delete imURL
            		dim imURL as c
            		[COLOR="#FF0000"]on error resume error_handler[/COLOR]
            		imURL = imContent.items.item.media.medium.url
            		
            		imName = imContent.items.item.name
            	
            		'The returned image url is messed up for our next call because of &amp; which is included
            		'in the returned URL - fix it.
            		imURL = stritran(imURL,"&amp;","&")
            	
            
            		'The URL is a simple http call... use http_get.  The binary image data is returned in the body
            		dim result as p
            		result = http_get(imURL)
            	
            		'The image is binary - write it out to a file... or to a table
            		imImage = result.body
            		
            		'file.from_blob("C:\Temp\tempimage\\" + currUPC + ".jpg", imImage)
            		file.from_blob("C:\a5\Ver12web\tempimages\\" + currUPC + ".jpg", imImage)  
            		'sleep(1)
            		'sourceFile = "C:\Temp\tempimage\\" + currUPC + ".jpg"
            		'destinationFile = "C:\Temp\newimage\\" + currUPC + ".jpg"
            		sourceFile = "C:\a5\Ver12web\tempimages\\" + currUPC + ".jpg"
            		destinationFile = "C:\a5\Ver12web\images\\" + currUPC + ".jpg"
            		
            		a5_runImageMagicCommand(sourceFile,destinationFile,"-resize 50x50")
            		'destinationFile = "C:\Temp\newlarge\\" + currUPC + ".jpg"
            		destinationFile = "C:\a5\Ver12web\images\full\\" + currUPC + ".jpg"
            		a5_runImageMagicCommand(sourceFile,destinationFile,"-resize 350x350")
            		file.remove(sourceFile)
            		'Write it back out to the table
            		'debug(1)
            		
            		args.set("argsUPC",currUPC)
            		args.set("argsURL",imURL)
            		args.set("pic_url","http://ugimg.com/images/" + currUPC + ".jpg")
            				
            		sqlStmt = <<%str%
            		 	UPDATE products
            		 	set picture_ref = :argsURL, picture_url = :pic_url,new_field2 = 'Office',upload_by = 'itemmaster'
            			WHERE UPC = :argsUPC;
            			%str%
            
            		flag = cn.Execute(sqlStmt,args)
            		if flag then
            			'ALL OK
            		else
            			'there was an error - close the connection and exit
            			cn.Close()
            			dim msg as c 
            			msg = "Could not execute the query. Error reported was: " + cn.CallResult.text
            			msg = js_escape(msg)
            			dim jscmd as c 
            			jscmd = "alert('" + msg + "');"
            			getItemMaster = jscmd
            			exit function
            		end if  
            	'end if
            	end if
            	delete cf_1
            [COLOR="#FF0000"]error_handler:	[/COLOR]
            next  
            
            
            cn.close()
            ce.close()
            
            'refresh the UX List control
            'getItemMaster = "{dialog.object}.refreshListData('ItemMasterList');"
            getItemMaster = "alert('All Item Master matching items have been downloaded');"
            Last edited by richardurban; 04-16-2015, 05:42 PM.
            Richard Urban

            Grocery Delivery Software for Stores and Entrepreneurs: http://www.urbangrocery.com

            Comment


              #21
              Re: Help with using API and http_fetch

              The error handler above is not correct: The one below is correct:

              Code:
              function getItemMaster as c (e as p)
              	
              'debug(1)
              
              'Here is the MySQL Table structure for the table used in this function
              'SET FOREIGN_KEY_CHECKS=0;
              'DROP TABLE IF EXISTS `tblitemmasterimages`;
              'CREATE TABLE `tblitemmasterimages` (
              '  `ItemId` int(10) NOT NULL AUTO_INCREMENT,
              '  `ItemUPC` varchar(20) DEFAULT NULL,
              '  `ItemDesc` varchar(255) DEFAULT NULL,
              '  `ItemImageURL` varchar(500) DEFAULT NULL,
              '  `ItemImage` longblob,
              '  PRIMARY KEY (`ItemId`)
              ') ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=latin1;
              
              
              dim cn as sql::Connection
              dim flag as l
              dim sqlStmt as c
              dim rs as sql::ResultSet
              dim args as sql::arguments
              
              flag = cn.open("::Name::urbangrocery")
              	args.set("from",e.dataSubmitted.from_code)
              	args.set("to",e.dataSubmitted.to_code)
              
              if flag then
              
              	sqlStmt = "SELECT UPC from products where new_code between :from and :to and (new_field2<>'Office' or new_field2 is null);"
              
              	flag = cn.Execute(sqlStmt,args)
              	if flag then
              		'ALL OK
              		rs = cn.ResultSet
              		myUPCList = rs.ToString()
              	else
              		'there was an error - close the connection and exit
              		cn.Close()
              		dim msg as c 
              		msg = "Could not execute the query. Error reported was: " + cn.CallResult.text
              		msg = js_escape(msg)
              		dim jscmd as c 
              		jscmd = "alert('" + msg + "');"
              		getItemMaster = jscmd
              		exit function
              	end if  
              	
              else
              	'there was an error - close the connection and exit
              	dim msg as c 
              	msg = "Could not open the connection. Error reported was: " + cn.CallResult.text
              	msg = js_escape(msg)
              	dim jscmd as c 
              	jscmd = "alert('" + msg + "');"
              	getItemMaster = jscmd
              	exit function
              end if
              
              'cn.FreeResult()
              
              
              'Set up a list of UPCs to get
              'dim myUPCList as c = <<%str%
              '012000005190
              '012000004926
              '012000008931
              '012000004995
              '078000160468
              '078000156461
              '078000152456
              '078000152463
              '078000003000
              '078000001143
              '%str%
              
              dim imURL as c
              dim imContentXML as c
              dim imContent as p
              dim imCount as n
              dim imName as c
              dim imImage as b
              
              dim flag_1 as l
              dim slist1[0] as c = [ "username:rurban" , "password:Password1" ]
              dim ce as extension::Curl
              ce = extension::Curl.Init()
              ce.setOpt("NOPROGRESS",1)
              ce.setOpt("USERAGENT","curl/7.34.0")
              ce.setOpt("HTTPHEADER",slist1)
              ce.setOpt("MAXREDIRS",50)
              ce.setOpt("CAINFO",a5.Get_Exe_Path()+"\caroot\ca-cert.pem")
              ce.setOpt("CAPATH",a5.Get_Exe_Path()+"\caroot")
              'ce.setOpt("SSH_KNOWNHOSTS","C:\Users\David\AppData\Roaming/_ssh/known_hosts")
              ce.setOpt("TCP_KEEPALIVE",1)
              
              'debug(1)
              for each imItem in myUPCList
              
              	currUPC = imItem.value
              	dim cf_1 as extension::CurlFile	
              	ce.setOpt("URL","https://api.itemmaster.com/v2/item?idx=0&limit=500&upc=" + currUPC + "&epl=600&ef=jpg")	
              	ce.SetOpt("FILE",cf_1)		
              
              	flag_1 = ce.Exec()
              
              	'get the reulting xml from the call
              	imContentXML = cf_1.GetContent()
              
              	'turn the xml into something nice we can use
              	delete imContent
              	dim imContent as p
              	imContent = *property_from_xml(imContentXML,imContent) 
              	
              	imCount = imContent.items.count
              	if imCount <> 0 then
              
              		'we have data from the UPC code
              		
              		'media is an array of images.  Just grab the 1st one.  Another loop is needed to get all images for a product
              		delete imURL
              		dim imURL as c
              		[COLOR="#FF0000"]on error goto missing_pic[/COLOR]
              		imURL = imContent.items.item.media.medium.url
              	
              		imName = imContent.items.item.name
              	
              		'The returned image url is messed up for our next call because of &amp; which is included
              		'in the returned URL - fix it.
              		imURL = stritran(imURL,"&amp;","&")
              	
              
              		'The URL is a simple http call... use http_get.  The binary image data is returned in the body
              		dim result as p
              		result = http_get(imURL)
              	
              		'The image is binary - write it out to a file... or to a table
              		imImage = result.body
              		
              		'file.from_blob("C:\Temp\tempimage\\" + currUPC + ".jpg", imImage)
              		file.from_blob("C:\a5\Ver12web\tempimages\\" + currUPC + ".jpg", imImage)  
              		'sleep(1)
              		'sourceFile = "C:\Temp\tempimage\\" + currUPC + ".jpg"
              		'destinationFile = "C:\Temp\newimage\\" + currUPC + ".jpg"
              		sourceFile = "C:\a5\Ver12web\tempimages\\" + currUPC + ".jpg"
              		destinationFile = "C:\a5\Ver12web\images\\" + currUPC + ".jpg"
              		
              		a5_runImageMagicCommand(sourceFile,destinationFile,"-resize 50x50")
              		'destinationFile = "C:\Temp\newlarge\\" + currUPC + ".jpg"
              		destinationFile = "C:\a5\Ver12web\images\full\\" + currUPC + ".jpg"
              		a5_runImageMagicCommand(sourceFile,destinationFile,"-resize 350x350")
              		file.remove(sourceFile)
              		'Write it back out to the table
              		'debug(1)
              		
              		args.set("argsUPC",currUPC)
              		args.set("argsURL",imURL)
              		args.set("pic_url","http://ugimg.com/images/" + currUPC + ".jpg")
              				
              		sqlStmt = <<%str%
              		 	UPDATE products
              		 	set picture_ref = :argsURL, picture_url = :pic_url,new_field2 = 'Office',upload_by = 'itemmaster'
              			WHERE UPC = :argsUPC;
              			%str%
              
              		flag = cn.Execute(sqlStmt,args)
              		if flag then
              			'ALL OK
              		else
              			'there was an error - close the connection and exit
              			cn.Close()
              			dim msg as c 
              			msg = "Could not execute the query. Error reported was: " + cn.CallResult.text
              			msg = js_escape(msg)
              			dim jscmd as c 
              			jscmd = "alert('" + msg + "');"
              			getItemMaster = jscmd
              			exit function
              		end if  
              	'end if
              	end if
              	delete cf_1
              	
              next  
              [COLOR="#B22222"]missing_pic:
              resume next[/COLOR]
              
              
              cn.close()
              ce.close()
              
              'refresh the UX List control
              'getItemMaster = "{dialog.object}.refreshListData('ItemMasterList');"
              getItemMaster = "alert('All Item Master matching items have been downloaded');"
              
              	
              end function
              Richard Urban

              Grocery Delivery Software for Stores and Entrepreneurs: http://www.urbangrocery.com

              Comment

              Working...
              X