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 Quote Link to comment 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 Quote Link to comment 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. Quote Link to comment 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 Quote Link to comment Share on other sites More sharing options...
BlueSkyIS Posted January 10, 2011 Share Posted January 10, 2011 yes, even if they're small thumbnails. Quote Link to comment 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. Quote Link to comment 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 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.