save images online then search and download to ipad

Easy Save 2 has been replaced by Easy Save 3, so is no longer supported.
paul4tune
Posts: 8
Joined: Wed Feb 25, 2015 12:13 am

save images online then search and download to ipad

Post by paul4tune »

what i need to be able to achieve is storing around 10,000 images online, on the ipad app i'll search those images by string name download the image to the ipad and then save it locally, can i achieve this with easysave 2 and arraymaker by playmaker
what will happen is, i'll be able to add more images to the database and not have to change anything on the app side
what would be the best way to achieve this ?

thanks
User avatar
Joel
Moodkie Staff
Posts: 4826
Joined: Wed Nov 07, 2012 10:32 pm

Re: save images online then search and download to ipad

Post by Joel »

Hi there,

Unfortunately I wouldn't be able to assist with the ArrayMaker plugin as I have no experience with it, but Easy Save supports Playmaker's 1.8 array functionality.

Firstly, you would need to follow the instructions here to set up the MySQL database and tables on your server. Then whenever you want to add a new image, you would need to make an FSM in Unity and use the Upload Image action to upload the image to the server.

Then to get a list of files on the server, you can use our upcoming Download Filenames action for Playmaker 1.8. I've attached a UnityPackage below which you can double-click to install the action. You would then need to go through each of these and use the Exists action to check whether it exists locally, and if not, use the Download File action to download it.

Then you can simply use the Load Image action to load it locally.

However, Playmaker isn't well suited to this, especially from a performance perspective.

All the best,
Joel
Attachments
ES2PlaymakerUpdate.unitypackage
(8.37 KiB) Downloaded 423 times
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
paul4tune
Posts: 8
Joined: Wed Feb 25, 2015 12:13 am

Re: save images online then search and download to ipad

Post by paul4tune »

thank you very much for the reply that really helped at the moment im getting an error code so ive completed the database setup and im getting this message ES2.php and MySQL database are working correctly‘.
but when uploading an image through unity i get an error code 00 and everything is as it should as per your tutorials

not sure what to do now




Joel wrote:Hi there,

Unfortunately I wouldn't be able to assist with the ArrayMaker plugin as I have no experience with it, but Easy Save supports Playmaker's 1.8 array functionality.

Firstly, you would need to follow the instructions here to set up the MySQL database and tables on your server. Then whenever you want to add a new image, you would need to make an FSM in Unity and use the Upload Image action to upload the image to the server.

Then to get a list of files on the server, you can use our upcoming Download Filenames action for Playmaker 1.8. I've attached a UnityPackage below which you can double-click to install the action. You would then need to go through each of these and use the Exists action to check whether it exists locally, and if not, use the Download File action to download it.

Then you can simply use the Load Image action to load it locally.

However, Playmaker isn't well suited to this, especially from a performance perspective.

All the best,
Joel
User avatar
Joel
Moodkie Staff
Posts: 4826
Joined: Wed Nov 07, 2012 10:32 pm

Re: save images online then search and download to ipad

Post by Joel »

Hi there,

What error message is being thrown? Error 00 denotes that there was a connection error at Unity's end (we use Unity's WWW class underneath), so you will need to look at the message to know the exact error.

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
paul4tune
Posts: 8
Joined: Wed Feb 25, 2015 12:13 am

Re: save images online then search and download to ipad

Post by paul4tune »

so your saying there is something wrong with unitys end, how would i find out what the specific problem is with 00
would unity know about that error code if i contact them
Joel wrote:Hi there,

What error message is being thrown? Error 00 denotes that there was a connection error at Unity's end (we use Unity's WWW class underneath), so you will need to look at the message to know the exact error.

All the best,
Joel
User avatar
Joel
Moodkie Staff
Posts: 4826
Joined: Wed Nov 07, 2012 10:32 pm

Re: save images online then search and download to ipad

Post by Joel »

Hi there,

You will need to look at the Error Message field of the action which is throwing the error, which should be below the Error Code field.

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
paul4tune
Posts: 8
Joined: Wed Feb 25, 2015 12:13 am

Re: save images online then search and download to ipad

Post by paul4tune »

error message is
has reported an upload error: 404 Not Found

the ES2.php file is in my public html folder and when inputting my url with the ES2.php on the end i get the confirmation message to say my database is working fine
Joel wrote:Hi there,

You will need to look at the Error Message field of the action which is throwing the error, which should be below the Error Code field.

All the best,
Joel
User avatar
Joel
Moodkie Staff
Posts: 4826
Joined: Wed Nov 07, 2012 10:32 pm

Re: save images online then search and download to ipad

Post by Joel »

Hi there,

Would you be able to PM me a screenshot of your action with the URL visible so I can try to test it at my end?

It may be that your server isn't allowing access to the PHP file. Also be aware that you must put http:// or https:// at the beginning of the url so that Unity knows what protocol to use.

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
User avatar
Joel
Moodkie Staff
Posts: 4826
Joined: Wed Nov 07, 2012 10:32 pm

Re: save images online then search and download to ipad

Post by Joel »

Hi there,

Thanks for getting the screenshots for me. I've just tested it and it appears that your server is rejecting any requests which have binary POST parameters.

To test this, I created a script which purely uses Unity's WWW class to upload to your ES2.php script which I've attached below. Whenever you add binary data to the POST data, your server returns a 404.
using UnityEngine;
using System.Collections;

public class UploadTest : MonoBehaviour 
{
	IEnumerator Start () 
	{
		WWWForm form = new WWWForm();
		form.AddBinaryData("data", new byte[]{(byte)0});
		WWW www = new WWW("http://www.yoururl.co.uk/ES2.php", form);
		yield return www;

		if(!string.IsNullOrEmpty(www.error))
			Debug.LogError(www.error);
		else
			Debug.Log("Done");
	}
}
You'll need to contact your server provider to get them to remove the restriction, otherwise it will not be possible to send data to your server.

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
paul4tune
Posts: 8
Joined: Wed Feb 25, 2015 12:13 am

Re: save images online then search and download to ipad

Post by paul4tune »

thank you for looking into this much appreciated ive contacted my server admin
Joel wrote:Hi there,

Thanks for getting the screenshots for me. I've just tested it and it appears that your server is rejecting any requests which have binary POST parameters.

To test this, I created a script which purely uses Unity's WWW class to upload to your ES2.php script which I've attached below. Whenever you add binary data to the POST data, your server returns a 404.
using UnityEngine;
using System.Collections;

public class UploadTest : MonoBehaviour 
{
	IEnumerator Start () 
	{
		WWWForm form = new WWWForm();
		form.AddBinaryData("data", new byte[]{(byte)0});
		WWW www = new WWW("http://www.yoururl.co.uk/ES2.php", form);
		yield return www;

		if(!string.IsNullOrEmpty(www.error))
			Debug.LogError(www.error);
		else
			Debug.Log("Done");
	}
}
You'll need to contact your server provider to get them to remove the restriction, otherwise it will not be possible to send data to your server.

All the best,
Joel
Locked