How do I: 1.make URL-checking system; 2.localfile's paths

Get help using Construct 2

Post » Mon Mar 23, 2015 2:43 pm

The first part is about URL-checking system.

What do I have?
A list of URLs

What do I need?
Check every URL:
1. It is an IMAGE
2. There is no request errors on it

Result?
If they are all images and there are no errors - message 'All is OK'
On any error - mark bad URLs with error type (not an image or 404 or ...)

----------

The second part is about localfile's links

What do I have?
Several files on disk. Platform may be Browser, PC, Android, iOS.

What do I need?
1. Take path for every file like an URL or with other method to have access to them at any time with this link.
2. Not to take path if it is not an image

Common result is:
save list of urls and file paths to a file

I will attach my project file soon, you'll see what I have done (can't do it right now). But I can't make it to be universal for every platforms. Also I'll write you my problems. I've tried to make it for several hours, and no good results..
B
8
S
1
Posts: 72
Reputation: 606

Post » Mon Mar 23, 2015 8:33 pm

NickRimer wrote:What do I have?
Several files on disk. Platform may be Browser, PC, Android, iOS.

What do I need?
1. Take path for every file like an URL or with other method to have access to them at any time with this link.
2. Not to take path if it is not an image


The links most likely wont be like URLs.
If you take the files from your local storage of the device running the app for file recognition, you would get links to local files, and not widely accessible URL links. The construct 2 app is not a server.
Who dares wins
B
56
S
16
G
21
Posts: 1,875
Reputation: 19,406

Post » Tue Mar 24, 2015 7:56 am

@lennaert
With FileChooser I can take a FileChooser.FileURLAt(0) after picking the file.
But if I store this "URL" and then will try to access file with this link in another session - it's a bad way. Because it will be incorrect link.
On the other way FileChooser.FileNameAt(0) gives just a filename and no path to it. So I can't find this file next time knowing just its name even in this session..

I need to save some path to local file to access it in any session (of course with condition that file is in its place)

In NodeWebkit it's easy. What about other platforms?
B
8
S
1
Posts: 72
Reputation: 606

Post » Tue Mar 24, 2015 11:22 am

FileURLAt(loopindex) isnt a real path/url .. its a blob of characters representing the entire file.


In a project for multiple file uploading, I use an array to store the entire files, perhaps this is something for you ....

The following requires rojohounds paster

viewtopic.php?f=147&t=127187&p=899532&hilit=multiple+image+uploader#p899532
Who dares wins
B
56
S
16
G
21
Posts: 1,875
Reputation: 19,406

Post » Tue Mar 24, 2015 11:55 am

@lennaert I'll take a look at this right now and tell you about results!

----- UPDATE

WOW! Paster.imgURL works more-more-nore faster than Sprite.ExtractImage.currentImage behavior "Extract sprite to base64 string" by @Pode

I've just made an experiment on one of files:
Paster - about 1..1,5 seconds
ExtractImage - about 10..11 (!!!) seconds

I will use Paster for now! Thank you very much for your time and help!!
And with jsZIP plugin by @Noncentz705 I can now zip all this image data to one file and reload it any time I want :)
The only difference is that base64 format often has bigger weight. For example, my uploaded 53 kB JPEG converts into 300 kB PNG
B
8
S
1
Posts: 72
Reputation: 606


Return to How do I....?

Who is online

Users browsing this forum: Ajbael, Pulstar and 9 guests