how to download an image

Matt Maier blueback09 at gmail.com
Tue Jun 20 20:46:25 EDT 2017


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 at 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
>  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