By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,344 Members | 1,147 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,344 IT Pros & Developers. It's quick & easy.

Save Bitmap from Flash to .NET as JPG

P: n/a
Hi everyone,

Just joined this group. I have a question about saving bitmap images
from flash too a .NET site using VBScript.

There are several tutorials showing how this can be done using php (for
instance, check out <a
and <a
but there is not enough help and support for those who have to use

Basically, I need to write a script that does exactly the same thing as
the php scripts given in the tutorials above, and I have no clue how I
will do that. VBS is sooo different than php, and I'm not used to it at
all. Besides, without the intrinsic GD library of php, it looks like I
might need to install an external GD library to work with.

This is the php code I'm talking about.

//If GD library is not installed, say sorry
if(!function_exists("imagecreate")) die("Sorry, you need GD library
to run this example");
//Capture Post data
$data = explode(",", $_POST['img']);
$width = $_POST['width'];
$height = $_POST['height'];
//Allocate image

$image=(function_exists("imagecreatetruecolor"))?i magecreatetruecolor(
$width ,$height ):imagecreate( $width ,$height);
imagefill($image, 0, 0, 0xFFFFFF);
//Copy pixels
$i = 0;
for($x=0; $x<=$width; $x++){
for($y=0; $y<=$height; $y++){
while(strlen($data[$i]) < 6) $data[$i] = "0" . $data[$i];
$r = 255-hexdec("0X".substr( $data[$i] , 0 , 2 ));
$g = 255-hexdec("0x".substr( $data[$i] , 2 , 2 ));
$b = 255-hexdec("0x".substr( $data[$i++] , 4 , 2 ));
$color = ($r << 16) | ($g << 8) | $b;
$color = imagecolorallocate($image, $r, $g, $b);
imagesetpixel ( $image , $x , $y , $color );
//Output image and clean
header( "Content-type: image/jpeg" );
ImageJPEG( $image );
imagedestroy( $image );

Hoping that someone has had to do something like this at one point or
another. All tips and advice would be appreciated.

Nov 7 '06 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.