[PHP] RE: suggestion required

2009-05-15 Thread Pravinc
Hey thanks for your quick reply,

Here is what i have done


This is my flex code


var issFront:ImageSnapshot =
ImageSnapshot.captureImage(_model.productDesigner._boundingBox, dpi, new
PNGEncoder(), false);
var ba:ByteArray = issFront.data;
ba.compress();
jpegBackProcessParams.jpegstreamFront = ba;


first capturing image then converting into bytearray
then compressing and then sending this parameter to PHP side using AMF-PHP

This is my PHP side Code


1# way

$data = $data[jpegstreamFront];
$data = $data-data;
$data = @gzuncompress($data);
@file_put_contents(../../pictures_final/hello.png,$data);


2# way

$data = $data[jpegstreamFront];
$data = $data-data;
$data = @gzuncompress($data);$fp =
@fopen(../../pictures_final/hello.txt,w+);
@fwrite($fp,$data,strlen($data));
@fclose($fp);


1# way

I tried generating Image directly from byte array ...

2# way

I tried second way to store the byte array in text file and then generate
300 DPI image using file operation and file_put_contents ..


In both case 
when Flex sends 300 Dpi size image around(2600x3000)
And data depending upon the design in Image..
And the browser get hang...


The issue is with sending Flex data to PHP side
Once I got byte array data in PHP side its not a big deal to generate
image..



Regards
Pravin Chhasatiya 

-Original Message-
From: Nathan Rixham [mailto:nrix...@gmail.com] 
Sent: Friday, May 15, 2009 3:21 AM
To: Pravinc
Cc: php-general@lists.php.net
Subject: Re: suggestion required

Pravinc wrote:
 Hey all,
 
 I have one flex+PHP application.
 
 Main purpose of the site is to sell T-shirts online.
 
  
 
 Flex is used for generating different designs on available tshirt.
 
 Something similar to Cafepress dot com.
 
  
 
 I want to generate 300 DPI tshirt image from flex and send it to PHP side
 for processing.
 
 Now the question is Flex doen't support direct image generation.
 
 So flex send's a Bytearray for 300 dpi image which is quite Bigger.some
time
 it crashes the browser while processing..because of heavy data..
 
  
 
 And can not store in any of MySQL datatype.
 
 Also storing in a txt file is too much time taking process..
 
  
 
 Any Suggestion or help to come out fron this issue..
 

Hi,

ByteArray should be fine, simply ensure you pack it before sending, then 
unpack it and read the floats back out with php to get the pixel values, 
you can then recompile with gd or suchlike (set pixel methods) and save 
as an image.

Your alternative is to go with flash player 10 specific action script 3 
and use vectors or fxg (on this note there are also some svg parsers for 
action script, 3rd party for fp9) - this approach will give you the same 
results but substantially less bytesize - whilst giving you no loss in 
quality seeing as they are vectors)

one recommendation I would make is to use display objects throughout the 
process clientside, then BitmapData.draw( DisplayObject ) to a 
BitmapData, then getPixels on that to get your bytearray at the last minute.

If you really come up short you can look at using alchemy to embed some 
C processing code in there, it really speeds up the process of working 
with huge ByteArrays as the c code is preoptimised and runs much faster.

Many Regards,

Nathan


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: suggestion required

2009-05-14 Thread Nathan Rixham

Pravinc wrote:

Hey all,

I have one flex+PHP application.

Main purpose of the site is to sell T-shirts online.

 


Flex is used for generating different designs on available tshirt.

Something similar to Cafepress dot com.

 


I want to generate 300 DPI tshirt image from flex and send it to PHP side
for processing.

Now the question is Flex doen't support direct image generation.

So flex send's a Bytearray for 300 dpi image which is quite Bigger.some time
it crashes the browser while processing..because of heavy data..

 


And can not store in any of MySQL datatype.

Also storing in a txt file is too much time taking process..

 


Any Suggestion or help to come out fron this issue..



Hi,

ByteArray should be fine, simply ensure you pack it before sending, then 
unpack it and read the floats back out with php to get the pixel values, 
you can then recompile with gd or suchlike (set pixel methods) and save 
as an image.


Your alternative is to go with flash player 10 specific action script 3 
and use vectors or fxg (on this note there are also some svg parsers for 
action script, 3rd party for fp9) - this approach will give you the same 
results but substantially less bytesize - whilst giving you no loss in 
quality seeing as they are vectors)


one recommendation I would make is to use display objects throughout the 
process clientside, then BitmapData.draw( DisplayObject ) to a 
BitmapData, then getPixels on that to get your bytearray at the last minute.


If you really come up short you can look at using alchemy to embed some 
C processing code in there, it really speeds up the process of working 
with huge ByteArrays as the c code is preoptimised and runs much faster.


Many Regards,

Nathan

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php