Jump to content

AS3 ByteArray equivelent in PHP?


rondog

Recommended Posts

Flash can read byteArrays. Does PHP have a method that can convert say an uploaded image into a bytearray? I will be storing it into a longblob field in a DB. I plan to then read that bytearray back into flash and output it as an image.

 

Here is the AS3 method of byteArray: http://www.adobe.com/livedocs/flash/9.0/ActionScriptLangRefV3/flash/utils/ByteArray.html

Link to comment
https://forums.phpfreaks.com/topic/223984-as3-bytearray-equivelent-in-php/
Share on other sites

i wouldn't store images in a database. i would store the file name in the database and save the image as a regular image file.

 

even if they're small thumbnails? My reason for doing this is when they delete the photo, it deletes the reference to the blob as well. I suppose I can delete the actual file by using the file name

How do I save the image to the server? I am using this and this works for just displaying the thumbnail I am creating.

<?php
$src = $_FILES['Filedata']['tmp_name'];
$img = imagecreatefrompng($src);
$width = imagesx($img);
$height = imagesy($img);
$new_width = 141;
$new_height = floor($height * ($new_width / $width));
$tmp_img = imagecreatetruecolor($new_width, $new_height);
imagecopyresized($tmp_img, $img, 0, 0, 0, 0, $new_width, $new_height, $width, $height);
imagejpeg($tmp_img,NULL,40);
imagedestroy($tmp_img);
?>

 

edit::nvm imagejpeg is where its at

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.