I am attempting to write a set of PHP functions capable of decoding a JSON object encoded to a string and written to a file, but am consistently running into some problems.
The source file in question is a .lumi file used to encode data for the Lumise product customiser application.
.lumi files are url-encoded text strings with multiple embedded data URLs which can be decoded to JSON objects, but the complexity of the file is causing me problems.
The objective is to take the input .lumi file, parse out the embedded data URLs and save these to either images or text files (depending on the data URL type) and then parse the rest of the file into a format that can be easily read by PHP to extract specific sections of data.
I am having some difficulty reliably the data URLs, preg_replace to match the data URLs via regex appears not to work, and various hacky alternatives such as splitting by various characters or strings such as “data:image” and looping through and seem to result in malformed JSON – or possibly just JSON which is problematic for PHP’s json_decode function to correctly parse.
In cases where I manage to extract and save the embedded data URLs, replacing them with strings such as [DATAURL_1], [TEXTURL_1] etc I am then running into problems correctly parsed an embedded string, which can be decoded to a child object.
I will provide a selection of .lumi files to experiment with, as well as the PHP code I have produced so far for example purposes.
I will need to test the resulting code on a variety of different .lumi files generated by the Lumise application, as well as ensure I can extract all data needed.
Once this is achieved I will also need a function to reverse the process, converting from a modified JSON data object which is more human readable, back into a .lumi file of the equivalent encoding.
I imagine this is not an exceedingly complex task – the issue is simply handling the variable and possibly malformed or non-standard encodings – but I have wasted too much time on it myself already, so am hopeful that someone else will be able to do a better job.
This project will be in 2 parts - the first will be to achieve reliable decoding of any example input .lumi - the second part, once I have tested that part 1 has been achieved, will be to reverse the process, converting an input human-readable .JSON file and associated images into a .lumi file readable by the Lumise application - with some specific adjustments such as scaling the input images to a given maximum proportion.
SEO & Social Media Specialist Needed Category: Facebook Marketing, Internet Marketing, Link Building, SEO, Social Media Marketing Budget: $30 - $250 USD