SVG and PNG Clip Art Stack

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

ClipArtGuy
Posts: 253
Joined: Wed Aug 19, 2015 4:29 pm

Re: SVG and PNG Clip Art Stack

Post by ClipArtGuy » Thu Sep 13, 2018 6:10 pm

bogs wrote:
Thu Sep 13, 2018 6:00 pm
ClipArtGuy wrote:
Thu Sep 13, 2018 5:09 pm
If it IS slow server/truncated data, it may be that the put URL command doesn't wait to be fully loaded before moving along, and might explain the "unexpected end of input error?
Well, there is an easy way to see if that is it, dl the file completely and then put it through JSONImport. Of course, you'd have to run it a lot considering your experience of random happenings.
Well, I changed this code preceding the JSONimport function:

Code: Select all

put URL("http://openclipart.org/search/json/?query="&tQuery&"&amount=10") into tClipArt
to this:

Code: Select all

 get URL("http://openclipart.org/search/json/?query="&tQuery&"&amount=10") 
   put it into tClipArt
And it *seems* to have alleviated the issue, I will report back if the error re-appears.

[-hh]
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2262
Joined: Thu Feb 28, 2013 11:52 pm
Location: Göttingen, DE

Re: SVG and PNG Clip Art Stack

Post by [-hh] » Mon Sep 24, 2018 5:44 pm

Hi ClipArtGuy,

why did you remove your "OpenClipArt Downloader" from "Sample Stacks"/livecodeshare ?
I miss the stack.

H.
shiftLock happens

bogs
Posts: 5435
Joined: Sat Feb 25, 2017 10:45 pm

Re: SVG and PNG Clip Art Stack

Post by bogs » Mon Sep 24, 2018 5:48 pm

That sounds like an interesting stack to have around, so even though I never saw it, I think I miss it too :mrgreen:
Image

ClipArtGuy
Posts: 253
Joined: Wed Aug 19, 2015 4:29 pm

Re: SVG and PNG Clip Art Stack

Post by ClipArtGuy » Mon Sep 24, 2018 7:10 pm

[-hh] wrote:
Mon Sep 24, 2018 5:44 pm
Hi ClipArtGuy,

why did you remove your "OpenClipArt Downloader" from "Sample Stacks"/livecodeshare ?
I miss the stack.

H.
Yes, I took it down, because in addition to the bug already mentioned in this thread in regards to the JSONimport function, a new bug has appeared across all versions of this stack where the gallery will fail to load some of the images. There have been no major changes to the stack, and I have tested on 3 different machines with 3 different OS's, as well as several versions of LC, as well as several backups of this stack going back a couple years, and the gallery bug has appeared in all of them. Not really sure what's going on with this stack, as I have been using it for a few years now without issue, but I've taken it down in the meantime until I can figure it out.

You can download from here if you'd like to check it out, but to me it seems to be broken for some unknown reason...

Code: Select all

www.probablyusererror.com/stacks/ClipArtDownloader.livecode
EDIT: the gallery bug even appears in old standalone versions of this stack that used to work fine, so I am of the mind that it may be an issue with the openclipart API/server, but I have no idea really...

ClipArtGuy
Posts: 253
Joined: Wed Aug 19, 2015 4:29 pm

Re: SVG and PNG Clip Art Stack

Post by ClipArtGuy » Mon Sep 24, 2018 10:44 pm

Upon further inspection the openclipart,org API does appear to be misreporting the png dimensions as "0". The current resizing script uses those dimensions to fit the images into the boxes. I have sent an e-mail to openclipart, and in the meantime have changed the script slightly to avoid using the bad data from the API. It seems to be working well now, but no guarantees. I will eventually re-upload this stack, but I want to make sure no more weird bugs appear.

The JSONimport bug and "Gallery bug" *seem* to have been worked out, The newer versiont can be downloaded here:

www.probablyusererror.com/stacks/ClipAr ... 2.livecode

bogs
Posts: 5435
Joined: Sat Feb 25, 2017 10:45 pm

Re: SVG and PNG Clip Art Stack

Post by bogs » Tue Sep 25, 2018 5:59 pm

Works great here. I really wish I had seen it earlier, but thanks!
Image

ClipArtGuy
Posts: 253
Joined: Wed Aug 19, 2015 4:29 pm

Re: SVG and PNG Clip Art Stack

Post by ClipArtGuy » Tue Sep 25, 2018 10:48 pm

bogs wrote:
Tue Sep 25, 2018 5:59 pm
Works great here. I really wish I had seen it earlier, but thanks!
I'm glad it's working for you. I think you've said previously that you tend to stay in the 6.x.x series, you should be able to get this stack working in those versions by throwing the FastJSON library into the stack script, commenting out all the JSONimport commands in the card script, and un-commenting the arrayFromJson lines directly above them.

bogs
Posts: 5435
Joined: Sat Feb 25, 2017 10:45 pm

Re: SVG and PNG Clip Art Stack

Post by bogs » Wed Sep 26, 2018 2:57 pm

Heh, well, 6.x is the newest I use, 2nd to Mc 2.6 which is my primary IDE.
ClipArtGuy wrote:
Tue Sep 25, 2018 10:48 pm
you should be able to get this stack working in those versions by throwing the FastJSON library into the stack script
I had already came to that conclusion myself (such a stinker I am) :wink: but good to know my thinking wasn't completely wonky :mrgreen:
Image

Post Reply

Return to “Talking LiveCode”