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
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

Link to comment
Share on other sites

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.