rondog Posted January 10, 2011 Share Posted January 10, 2011 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 More sharing options...
rondog Posted January 10, 2011 Author Share Posted January 10, 2011 maybe base64_encode? Shot in the dark here, hah Link to comment https://forums.phpfreaks.com/topic/223984-as3-bytearray-equivelent-in-php/#findComment-1157492 Share on other sites More sharing options...
BlueSkyIS Posted January 10, 2011 Share Posted January 10, 2011 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. Link to comment https://forums.phpfreaks.com/topic/223984-as3-bytearray-equivelent-in-php/#findComment-1157521 Share on other sites More sharing options...
rondog Posted January 10, 2011 Author Share Posted January 10, 2011 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 Link to comment https://forums.phpfreaks.com/topic/223984-as3-bytearray-equivelent-in-php/#findComment-1157531 Share on other sites More sharing options...
BlueSkyIS Posted January 10, 2011 Share Posted January 10, 2011 yes, even if they're small thumbnails. Link to comment https://forums.phpfreaks.com/topic/223984-as3-bytearray-equivelent-in-php/#findComment-1157534 Share on other sites More sharing options...
rondog Posted January 10, 2011 Author Share Posted January 10, 2011 alright I'll go ahead and just save an actual thumbnail. Link to comment https://forums.phpfreaks.com/topic/223984-as3-bytearray-equivelent-in-php/#findComment-1157535 Share on other sites More sharing options...
rondog Posted January 10, 2011 Author Share Posted January 10, 2011 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 Link to comment https://forums.phpfreaks.com/topic/223984-as3-bytearray-equivelent-in-php/#findComment-1157544 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.