Re: how to download an image

2017-06-20 Thread Matt Maier via use-livecode
Just following up for posterity.

The livecode team figured out that setting the httpheaders to empty solved
the problem, or at least part of it.
I was setting them to connect to the API that sends the link for the image.
Now setting them to empty before trying to download the image partly works.

It works for "put url"; the image file shows up and isn't corrupted.
It hasn't worked for libURLdownloadToFile; the image file doesn't show up.

On Sun, Jun 4, 2017 at 1:19 PM, Mark Wieder via use-livecode <
use-livecode@lists.runrev.com> wrote:

> I dunno. Here's what I just did and it loaded the image with no problems.
> All 97,183 bytes worth. Do you have write permission to the folder you're
> downloading to?
>
> on mouseUp
>local tImgUrl
>local tImgName
>local tNewFile
>constant tNewFolder="/home/mwieder/Desktop"
>
>put "//s3.amazonaws.com/appforest_uf/f1496548544475x140387106221
> 169240/grilled_cheese_on_plate.jpg" into tImgUrl
>
>put "https:" & tImgUrl into tImgUrl
>set itemdelimiter to "/"
>put item -1 of tImgUrl into tImgName
>set itemdelimiter to comma
>put tNewFolder & "/" & tImgName into tNewFile
>libURLDownloadToFile tImgUrl,tNewFile, "finished"
> end mouseUp
>
> on finished
>answer "All Done"
> end finished
>
>
> --
>  Mark Wieder
>  ahsoftw...@gmail.com
>
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: how to download an image

2017-06-04 Thread Mark Wieder via use-livecode
I dunno. Here's what I just did and it loaded the image with no 
problems. All 97,183 bytes worth. Do you have write permission to the 
folder you're downloading to?


on mouseUp
   local tImgUrl
   local tImgName
   local tNewFile
   constant tNewFolder="/home/mwieder/Desktop"

   put 
"//s3.amazonaws.com/appforest_uf/f1496548544475x140387106221169240/grilled_cheese_on_plate.jpg" 
into tImgUrl


   put "https:" & tImgUrl into tImgUrl
   set itemdelimiter to "/"
   put item -1 of tImgUrl into tImgName
   set itemdelimiter to comma
   put tNewFolder & "/" & tImgName into tNewFile
   libURLDownloadToFile tImgUrl,tNewFile, "finished"
end mouseUp

on finished
   answer "All Done"
end finished

--
 Mark Wieder
 ahsoftw...@gmail.com

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: how to download an image

2017-06-04 Thread Matt Maier via use-livecode
I've only tried it in the IDE so far.

On Sun, Jun 4, 2017 at 12:36 PM, tbodine via use-livecode <
use-livecode@lists.runrev.com> wrote:

> Is this happening in a standalone or the IDE? A standalone would need
> revsecurity.dll for https.
>
> Tom B.
>
>
>
> --
> View this message in context: http://runtime-revolution.
> 278305.n4.nabble.com/how-to-download-an-image-tp4715487p4715503.html
> Sent from the Revolution - User mailing list archive at Nabble.com.
>
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: how to download an image

2017-06-04 Thread tbodine via use-livecode
Is this happening in a standalone or the IDE? A standalone would need
revsecurity.dll for https.

Tom B.



--
View this message in context: 
http://runtime-revolution.278305.n4.nabble.com/how-to-download-an-image-tp4715487p4715503.html
Sent from the Revolution - User mailing list archive at Nabble.com.

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: how to download an image

2017-06-04 Thread Matt Maier via use-livecode
Yeah, I've got a list of URLs like the one in the first message
//s3.amazonaws.com/appforest_uf/f1496548544475x140387106221169
240/grilled_cheese_on_plate.jpg

I'm trying to download the images from AWS to a folder.

Previously I couldn't get "put URL into binfile" to work (0kb files) so I
tried downloading the base64 encoded image data instead. That required
using get/post, which is blocking. Blocking is bad.

So I tried getting the URL instead so I can use libURLDownloadToFile
instead.

I'm getting the same 0kb file problem.

On Sun, Jun 4, 2017 at 10:56 AM, Mark Wieder via use-livecode <
use-livecode@lists.runrev.com> wrote:

> On 06/04/2017 10:06 AM, Matt Maier via use-livecode wrote:
>
>> Hokay, so, apparently post is a blocking command, which is a bad idea for
>> multiple potentially large files. So I'm trying to use this, but it's
>> still
>> downloading 1kb files.
>>
>> *put* "https:" & tImgUrl into tImgUrl
>>
>> *set* itemdelimiter to "/"
>>
>> *put* item -1 of tImgUrl into tImgName
>>
>> *set* itemdelimiter to comma
>>
>> *put* tNewFolder & "/" & tImgName into tNewFile
>>
>> libURLDownloadToFile tImgUrl,tNewFile
>>
>
> Multiple unknowns here.
> First of all, you're conflating 'post' and 'downloading' which is muchly
> confusing.
>
> I assume that tImgUrl starts with "//" at the start of this code.
> Otherwise you'll need to add it after the "https:" prefix.
>
> And don't you want a callback message to make it asynchronous?
> And remember to check the URLStatus in the callback handler.
>
> --
>  Mark Wieder
>  ahsoftw...@gmail.com
>
>
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: how to download an image

2017-06-04 Thread Mark Wieder via use-livecode

On 06/04/2017 10:06 AM, Matt Maier via use-livecode wrote:

Hokay, so, apparently post is a blocking command, which is a bad idea for
multiple potentially large files. So I'm trying to use this, but it's still
downloading 1kb files.

*put* "https:" & tImgUrl into tImgUrl

*set* itemdelimiter to "/"

*put* item -1 of tImgUrl into tImgName

*set* itemdelimiter to comma

*put* tNewFolder & "/" & tImgName into tNewFile

libURLDownloadToFile tImgUrl,tNewFile


Multiple unknowns here.
First of all, you're conflating 'post' and 'downloading' which is muchly 
confusing.


I assume that tImgUrl starts with "//" at the start of this code. 
Otherwise you'll need to add it after the "https:" prefix.


And don't you want a callback message to make it asynchronous?
And remember to check the URLStatus in the callback handler.

--
 Mark Wieder
 ahsoftw...@gmail.com

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: how to download an image

2017-06-04 Thread Matt Maier via use-livecode
Hokay, so, apparently post is a blocking command, which is a bad idea for
multiple potentially large files. So I'm trying to use this, but it's still
downloading 1kb files.

*put* "https:" & tImgUrl into tImgUrl

*set* itemdelimiter to "/"

*put* item -1 of tImgUrl into tImgName

*set* itemdelimiter to comma

*put* tNewFolder & "/" & tImgName into tNewFile

libURLDownloadToFile tImgUrl,tNewFile

On Sun, Jun 4, 2017 at 8:55 AM, Matt Maier  wrote:

> I got bubble.is to send the base64 encoded image data instead of a link.
> So just putting the base64decoded data into URL is working.
>
> On Sun, Jun 4, 2017 at 12:41 AM, Colin Holgate via use-livecode <
> use-livecode@lists.runrev.com> wrote:
>
>> Scott’s routine worked for me too. It’s worth checking where the spaces
>> and returns there are in his test, I had to edit it from the email version.
>> I also just tested in the multiline message box. For testing in a button,
>> in LiveCode 8, you have to declare the variable as well. This was the whole
>> button script:
>>
>> on mouseUp
>>
>> local theURL
>>
>> put "http://s3.amazonaws.com/appforest_uf/f1496548544475x1403871
>> 06221169240/grilled_cheese_on_plate.jpg" into theURL
>>
>> put url theURL into url ("binfile:" & specialFolderPath("desktop") &
>> "/DLimage.jpg")
>>
>> end mouseUp
>>
>>
>> ___
>> use-livecode mailing list
>> use-livecode@lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your
>> subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>
>
>
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Re: how to download an image

2017-06-04 Thread Matt Maier via use-livecode
I got bubble.is to send the base64 encoded image data instead of a link. So
just putting the base64decoded data into URL is working.

On Sun, Jun 4, 2017 at 12:41 AM, Colin Holgate via use-livecode <
use-livecode@lists.runrev.com> wrote:

> Scott’s routine worked for me too. It’s worth checking where the spaces
> and returns there are in his test, I had to edit it from the email version.
> I also just tested in the multiline message box. For testing in a button,
> in LiveCode 8, you have to declare the variable as well. This was the whole
> button script:
>
> on mouseUp
>
> local theURL
>
> put "http://s3.amazonaws.com/appforest_uf/f1496548544475x140387106221169
> 240/grilled_cheese_on_plate.jpg" into theURL
>
> put url theURL into url ("binfile:" & specialFolderPath("desktop") &
> "/DLimage.jpg")
>
> end mouseUp
>
>
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Re: how to download an image

2017-06-04 Thread Colin Holgate via use-livecode
Scott’s routine worked for me too. It’s worth checking where the spaces and 
returns there are in his test, I had to edit it from the email version. I also 
just tested in the multiline message box. For testing in a button, in LiveCode 
8, you have to declare the variable as well. This was the whole button script:

on mouseUp

local theURL

put 
"http://s3.amazonaws.com/appforest_uf/f1496548544475x140387106221169240/grilled_cheese_on_plate.jpg;
 into theURL

put url theURL into url ("binfile:" & specialFolderPath("desktop") & 
"/DLimage.jpg")

end mouseUp


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Re: how to download an image

2017-06-04 Thread Matt Maier via use-livecode
That gives me a 375b corrupted file. So that's progress.

On Sat, Jun 3, 2017 at 9:49 PM, Scott Rossi via use-livecode <
use-livecode@lists.runrev.com> wrote:

> Remove the first "binfile" usage, so your code reads like this:
>
> put URL tNewImageLink into URL ("binfile:" & tNewFolder & "/" &
> tNewImageName)
>
>
> I used the following to test download to the desktop and it works as
> expected:
>
> put
> "http://s3.amazonaws.com/appforest_uf/f1496548544475x140387106221169
> 240/gri
> lled_cheese_on_plate.jpg" into theURL
> put url theURL into url ("binfile:" & specialFolderPath("desktop") &
> "/DLimage.jpg")
>
>
> Regards,
>
> Scott Rossi
> Creative Director
> Tactile Media, UX/UI Design
>
>
>
>
>
> On 6/3/17, 9:38 PM, "use-livecode on behalf of Matt Maier via
> use-livecode"  use-livecode@lists.runrev.com> wrote:
>
> >I'm trying to download an image to a file but it's always 0kb
> >
> >Here's an example of the URL I've got //
> >s3.amazonaws.com/appforest_uf/f1496548544475x140387106221169
> 240/grilled_ch
> >eese_on_plate.jpg
> >
> >*put* URL ("binfile:" & tNewImageLink) into URL ("binfile:" & tNewFolder &
> >"/" & tNewImageName)
> >
> >
> >*get* url tNewImageLink
> >
> >*put* it into URL ("binfile:" & tNewFolder & "/" & tNewImageName)
> >___
> >use-livecode mailing list
> >use-livecode@lists.runrev.com
> >Please visit this url to subscribe, unsubscribe and manage your
> >subscription preferences:
> >http://lists.runrev.com/mailman/listinfo/use-livecode
>
>
>
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: how to download an image

2017-06-03 Thread Mark Wieder via use-livecode

On 06/03/2017 09:49 PM, Scott Rossi via use-livecode wrote:

Remove the first "binfile" usage, so your code reads like this:


I was gonna say something similar, but Scott's too fast for me.

--
 Mark Wieder
 ahsoftw...@gmail.com

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: how to download an image

2017-06-03 Thread Scott Rossi via use-livecode
Remove the first "binfile" usage, so your code reads like this:

put URL tNewImageLink into URL ("binfile:" & tNewFolder & "/" &
tNewImageName)


I used the following to test download to the desktop and it works as
expected:

put 
"http://s3.amazonaws.com/appforest_uf/f1496548544475x140387106221169240/gri
lled_cheese_on_plate.jpg" into theURL
put url theURL into url ("binfile:" & specialFolderPath("desktop") &
"/DLimage.jpg")


Regards,

Scott Rossi
Creative Director
Tactile Media, UX/UI Design





On 6/3/17, 9:38 PM, "use-livecode on behalf of Matt Maier via
use-livecode"  wrote:

>I'm trying to download an image to a file but it's always 0kb
>
>Here's an example of the URL I've got //
>s3.amazonaws.com/appforest_uf/f1496548544475x140387106221169240/grilled_ch
>eese_on_plate.jpg
>
>*put* URL ("binfile:" & tNewImageLink) into URL ("binfile:" & tNewFolder &
>"/" & tNewImageName)
>
>
>*get* url tNewImageLink
>
>*put* it into URL ("binfile:" & tNewFolder & "/" & tNewImageName)
>___
>use-livecode mailing list
>use-livecode@lists.runrev.com
>Please visit this url to subscribe, unsubscribe and manage your
>subscription preferences:
>http://lists.runrev.com/mailman/listinfo/use-livecode



___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


how to download an image

2017-06-03 Thread Matt Maier via use-livecode
I'm trying to download an image to a file but it's always 0kb

Here's an example of the URL I've got //
s3.amazonaws.com/appforest_uf/f1496548544475x140387106221169240/grilled_cheese_on_plate.jpg

*put* URL ("binfile:" & tNewImageLink) into URL ("binfile:" & tNewFolder &
"/" & tNewImageName)


*get* url tNewImageLink

*put* it into URL ("binfile:" & tNewFolder & "/" & tNewImageName)
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode