• Blackberry DevCon – Register Now!
Zurück   Flashforum > Flash und Server > PHP und MySQL

Antwort
 
LinkBack Themen-Optionen Ansicht
Alt 15-11-2009, 19:24   #1 (permalink)
?-Developer
 
Registriert seit: Jul 2004
Ort: Zuchwil (CH)
Beiträge: 899
AMFPHP -> ByteArray in MySQL

Weiss jemand ob es möglich ist ein ByteArray Objekt, wirklich in
eine Datenbank abzuspeichern und danach wieder davon auszulesen?
Und ob es evtl. irgendwo ein "brauchbares" Tutorial gibt?
__________________
Nur tote Fische schwimmen mit dem Strom
silentx ist offline   Mit Zitat antworten
Alt 15-11-2009, 21:35   #2 (permalink)
Inventar
 
Benutzerbild von Nightflyer
 
Registriert seit: Jul 2002
Beiträge: 6.820
onebyoneblog Blog Archive Save/Retrieve ByteArrays to/from Database via AMFPHP
__________________
(\__/)
(='.'=)
(")_(")
Nightflyer ist offline   Mit Zitat antworten
Alt 15-11-2009, 22:33   #3 (permalink)
?-Developer
 
Registriert seit: Jul 2004
Ort: Zuchwil (CH)
Beiträge: 899
Sehr gutes Tutorial wie ich finde
Doch es scheint nicht mit BitmapData zu Funktioneren, aber danke
__________________
Nur tote Fische schwimmen mit dem Strom
silentx ist offline   Mit Zitat antworten
Alt 18-11-2009, 07:46   #4 (permalink)
?-Developer
 
Registriert seit: Jul 2004
Ort: Zuchwil (CH)
Beiträge: 899
Ich konnte es jetzt lösen. Es funktioniert wirklich auch mit BitmapData's.
Wenn es jemand genaueres wissen will, kann sich bei mir melden.
__________________
Nur tote Fische schwimmen mit dem Strom
silentx ist offline   Mit Zitat antworten
Alt 18-11-2009, 09:57   #5 (permalink)
exestiert hier nicht
 
Registriert seit: Jun 2002
Ort: Osnabrück
Beiträge: 1.728
erklär es doch hier kurz, dann lernen alle z.B ich auch davon :-).
__________________
<? if(!$success){ $try++; } ?>
~Es ist so grausam, dass der Intelligenz Grenzen gesetzt sind und der Dummheit keine.~

Werbung:
- Ajax File Manager ( KFM - Kae's File Manager )
Funkey ist offline   Mit Zitat antworten
Alt 18-11-2009, 12:38   #6 (permalink)
?-Developer
 
Registriert seit: Jul 2004
Ort: Zuchwil (CH)
Beiträge: 899
Ich Versuch es mal zu erklären...:
Das Beispiel lädt ein Bild aus dem gleichen Verzeichnis wie
die Klasse images ist (..\services\..)

1. Anpassung von AMFPHP (..\core\amf\io\AMFSerializer)
PHP-Code:
    function writeAmf3ByteArray($d)
    {
        
$this->writeByte(0x0C);
        
//this->writeAmf3String($d, true);
        
$this->writeAmf3ByteArrayBody($d); // New with Patch
    
}

    function 
writeAmf3ByteArrayBody($d// Function is New with Patch - http://www.sephiroth.it/weblog/archives/2008/07/amfphp_issue_referencing_bytearray.php
     
{
         if( (
$key patched_array_search($d$this->storedObjectsTRUE)) === FALSE && $key === FALSE )
         {
             if(
count($this->storedObjects) < MAX_STORED_OBJECTS)
             {
                 
$this->storedObjects[] = & $d;
             }

             
$this->storedDefinitions++;

             
$obj_length strlen$d );
             
$this->writeAmf3Int$obj_length << 0x01 );
             
$this->outBuffer .= $d;
         }
         else
         {
             
$handle $key << 1;
             
$this->writeAmf3Int($handle);
         }
     } 
2. PHP-Funktion erstellen
PHP-Code:
class images
{
    
// Konstruktor
    
public function images()
    {
        
$GLOBALS['amfphp']['encoding'] = 'amf3';
    }

    public function 
getImages($sqlBefehl)
    {
           return new 
ByteArray(file_get_contents("myFile.jpg"));
        }

3. Aufruf aus Flash und das Bild anzuzeigen
ActionScript:
  1. public var ldr:Loader;
  2. ...
  3. public function getImage():void
  4. {
  5.   con = new NetConnection();
  6.   con.objectEncoding = ObjectEncoding.AMF3;
  7.   resp = new Responder(resultFunction, resultFault);           
  8.   con.connect(gatewayURL);
  9.   con.call("images.getImages", resp);
  10. }
  11. public function resultFunction(byteArray:ByteArray):void
  12. {
  13.   ldr = new Loader();
  14.   ldr.contentLoaderInfo.addEventListener(Event.Complete, loadEnd);
  15.   ldr.loadBytes(byteArray);
  16. }
  17. public function loadEnd(evt:Event):void
  18. {
  19.    var loader:Loader = Loader(evt.target.loader);
  20.    loader.contentLoaderInfo.removeEventListener(Event.COMPLETE, loadEnd);
  21.            
  22.    var bitmapData:BitmapData = Bitmap(evt.target.content).bitmapData;
  23.    var btm:Bitmap = new Bitmap(bitmapData);
  24.    btm.x = 300;
  25.    btm.y = 50;
  26.   addChild(btm);
  27. }

Es ist so auch möglich Bilder in die mySQL-Datenbank abzuspeichern bzw. wieder
auszulesen
__________________
Nur tote Fische schwimmen mit dem Strom

Geändert von silentx (18-11-2009 um 12:39 Uhr)
silentx ist offline   Mit Zitat antworten
Antwort

Lesezeichen

Themen-Optionen
Ansicht

Forumregeln
Es ist Ihnen nicht erlaubt, neue Themen zu verfassen.
Es ist Ihnen nicht erlaubt, auf Beiträge zu antworten.
Es ist Ihnen nicht erlaubt, Anhänge hochzuladen.
Es ist Ihnen nicht erlaubt, Ihre Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks sind an
Pingbacks sind an
Refbacks sind an


LinkBacks (?)
LinkBack zu diesem Thema: http://www.flashforum.de/forum/php-und-mysql/amfphp-bytearray-mysql-277994.html
Erstellt von Für Art Datum Hits
onebyoneblog » Save/Retrieve ByteArrays to/from Database via AMFPHP Dieses Thema Refback 26-10-2011 08:57 4

Ähnliche Themen
Thema Autor Forum Antworten Letzter Beitrag
Einsatz von AMFPHP und KEINER MySQL-DB bobo_k1 Flash Remoting 6 06-06-2007 10:46
AMFPHP+PHP+mySQL: Die letzte Reihe, wie komme ich an die? mirzahat Server-Seite allgemein 6 30-08-2006 21:43
mysql-amfphp-flash, probleme mit umlauten oresde Flash Remoting 2 05-04-2006 18:33
Daten mit AMFPHP, PHP und MySQL durch AS2 auslesen und an Flash übergeben crashT Flash Remoting 16 06-03-2006 11:12
amfphp - MySQL UPDATE Fehlermeldung dante Flash MX 2004 2 05-01-2006 10:17


Alle Zeitangaben in WEZ +1. Es ist jetzt 06:08 Uhr.

Domains, Webhosting & Vserver von Host Europe
Unterstützt das Flashforum!
Adobe User Group


Copyright ©1999 – 2012 Marc Thiele