Page 1 of 1

Encoded/Encrypted Data Help.

Posted: Sun Apr 30, 2006 12:11 pm
by R4000
I'm trying to parse the image data i get back from a flash file (ffART, used on Bebo.com).
I do not have access to any documentation about this ffART thingy.
And i have tried every possible way i could think of to try and use this data.

The data I get back from the swf file is:

Code: Select all

array(5) {
  ["X0"]=>
  string(10) "3a0a58a126"
  ["X"]=>
  string(1) "1"
  ["CANVASCOLOUR"]=>
  string(5) "13158"
  ["HEIGHT"]=>
  string(3) "401"
  ["WIDTH"]=>
  string(3) "601"
}
CANVASCOLOUR i have allready figured out is a hex converted to dec (simple dechex() to get back)
HEIGHT and WIDTH are pretty self explanitary
X i have no idea what this is for... but when i dont put any data on the image (other than the canvas) it is set to 0 and i dont have the X0 argument.
X0 is the image data... the part i can't figure out.

I suspect its been pack()'ed but ive tried loads of unpack() methods and not got any data.
I tried base64_decode, it looked promising but didnt actualy get me anywhere because it had no headers... i tried appending it to the bottom of a gif file using this code:

Code: Select all

header("Content-type: image/gif");
$im = imagecreate($_REQUEST['WIDTH'], $_REQUEST['HEIGHT']);
$cols = hex2rgb($canvascolor, false);
$bg = imagecolorallocate($im, $cols[0],$cols[1],$cols[2]);
imagegif($im);
echo base64_decode($_REQUEST['X0']);
(hex2rgb is a small function to turn the hex code into RGB.)
This didn't work (I didn't expect it too)
But it did generate a valid image... that had the correct background color.

If you have any hints please let me know! (or if you know of any other flash whiteboards that use a php backend, with docs!)

Posted: Sun Apr 30, 2006 2:47 pm
by R4000
Figured the pattern out guys... :)

If i draw a pixel in the top left hand corner with pen size 47... i get: 47a0a0a2
I noticed a pattern... **a*a*a*... lots of a's
If i explode('a',$X0); I get:

Code: Select all

array(4) {
  [0]=>
  string(2) "47"
  [1]=>
  string(1) "0"
  [2]=>
  string(1) "1"
  [3]=>
  string(1) "1"
}
And that just happens to be:

Code: Select all

array(4) {
  [pen size]=>
  string(2) "47"
  [color, (dec of a hex just like canvas)]=>
  string(1) "0"
  [x]=>
  string(1) "0"
  [y]=>
  string(1) "2"
}
Now im just writing a quick script to turn these structures back into an image :D

Posted: Sun Apr 30, 2006 5:11 pm
by R4000
Ive done my script... i worked good, but most colours dont show as the correct colour. and you cant use a pen size bigger than one :) http://geniteas.homeip.net/xampp/ffart.php

All i really need is a SIMPLE FLASH whiteboard that can use PHP to store the image, does anybody know of a free one?

Posted: Sun Apr 30, 2006 5:13 pm
by John Cartwright
fyi, I cannot access that page.

Posted: Sun Apr 30, 2006 5:16 pm
by R4000
No idea why not, what error you get? No probs here, or with ay of my msn contacts. maybe its cause ur in canada... dns might still be screwed over there

Posted: Sun Apr 30, 2006 5:29 pm
by John Cartwright
cough cough, check your spelling in the link :wink:

Posted: Sun Apr 30, 2006 5:32 pm
by R4000
oh yea :P http://geniteas.homeip.net/xampp/ffart.php its xampp not xammp stupid me :P.... i always do that