how to download an image

Matt Maier blueback09 at gmail.com
Sun Jun 4 15:25:47 EDT 2017


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 at 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
>  ahsoftware at gmail.com
>
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>



More information about the use-livecode mailing list