SQLite BLOB schreiben in standalone

Startseite Foren Deutsches LiveCode-Forum SQLite BLOB schreiben in standalone

Ansicht von 4 Antwort-Themen
  • Autor
    Beiträge
    • #16296
      RolfG
      Teilnehmer

        Hallo,
        habe ein seltsames Phänomen: Ich möchte ein Image in ein BLOB-Feld einer SQLite-Datenbank schreiben. Das klappt im Entwicklungssystem wunderbar, im Windows-standalone schreibt er etwas, das jedoch dann gelesen wie ein leeres Bild aussieht. Im Entwicklungssystem einmal korrekt geschriebene Bilder kann er aber auch im standalone korrekt lesen und anzeigen.
        Ist das ein library-Problem? Ich denke SQLite kann livecode immer?
        Das ist der Code:
        put the text of image “Foto_mini” into theFoto_mini

        put “UPDATE bilder SET “& \
        “Minibild = :1 WHERE schluessel = ” & theSchluessel into sql

        revExecuteSQL dbid, sql, “*btheFoto_mini”

        Auch bei put image “Foto_mini” into theFoto_mini passiert das gleiche.

        Was tun?

      • #16344
        RolfG
        Teilnehmer

          Hallo,
          das Problem stellt sich nach umfangreichen Tests doch anders dar. Es liegt nicht am BLOB-Update, sondern an der Aufbereitung der binären Daten (also eines images) vorher. Herausbekommen hab ich das dadurch, dass ich im Test einmal durch das Entwicklungssystem korrekt in die Datenbank geschriebene Daten eines anderen Datensatzes im Windows-standalone neu ausgelesen und einfach nur wieder in einen weiteren Datensatz zurückgeschrieben habe. Und oh Wunder, er ist korrekt.
          Das Problem sieht nun so aus:
          Ich möchte ein verkleinertes Bild einer Postkarte in der DB speichern, um es dann in einer Übersicht mit mehreren kleinen Bildern anzuzeigen. Dazu lese ich das Originalfoto in ein Image “Foto”, verkleinere es und ziehe danach davon per snapshot ein Image “Foto_mini”. Der Text von “Foto_mini” wird in eine Variable theFotoMini kopiert und hier geht der Ärger los:

          Im Entwicklungssystem steht in theFotoMini so etwas wie ‰PNG…, lässt man sich das im standalone anzeigen, erscheint hier etwas völlig anderes.

          Das ist der Code:

          create invisible image “Foto”
          set the filename of image “Foto” to theFile
          set the height of image “Foto” to 63
          set the width of image “Foto” to 95
          set the top of image “Foto” to 70
          set the left of image “Foto” to 50
          import snapshot from rect (the rect of image “Foto”) of image “Foto”
          set the text of image “Foto” to the text of the last image
          set the name of the last image to “Foto_mini”
          set visible of image “Foto_mini” to FALSE
          set the height of image “Foto_mini” to 63
          set the width of image “Foto_mini” to 95
          set the left of image “Foto_mini” to 50
          set the top of image “Foto_mini” to 70
          set visible of image “Foto_mini” to TRUE
          put text of image “Foto_mini” into theMiniBild

          Ist es das Import snapshot? Wieso verhält es sich im Entwicklungssystem anders als im standoalone?

          Danke für die Hilfe im voraus!

        • #16346
          Klaus Major
          Administrator

            Hi Rolf,

            habe das hier unter “paintcompression” im Dictionary gefunden:

            By default, the global paintCompression property is set to “rle” in standalones and “png” in the development environment.

            Bin darauf gekommen, weil Du schriebst, in der Runtime stände dort etwas Anderes als “.PNG”. 😎
            Woher weisst Du das eigentlich? Schreibst Du das in ein Feld?

            Also vielleicht mal zunächst wieder auf PNG in der Standalone stellen und erneut probieren?

            ...
            set the left of image "Foto" to 50
            ## !!!
            set the paintcompression to "PNG"
            ## !!
            import snapshot from rect (the rect of image "Foto") of image "Foto"
            ...

            Keine Ahnung, ob das das Problem ist, aber Versug macht klug! 🙂

            Gruß

            Klaus

            P.S.
            Du kannst Dir etwas Tipparbeit sparen:

            ...
            put "50,70,145,133" into tRect
            set the rect of image "Foto" to tRect
            ## set the height of image "Foto" to 63
            ## set the width of image "Foto" to 95
            ## set the top of image "Foto" to 70
            ## set the left of image "Foto" to 50
            ...
            set the rect of img "Foto_Mini" to tRect
            ## set the height of image "Foto_mini" to 63
            ## set the width of image "Foto_mini" to 95
            ## set the left of image "Foto_mini" to 50
            ## set the top of image "Foto_mini" to 70
            ...

            🙂

          • #16348
            RolfG
            Teilnehmer

              SUPER Klaus, weiß Dein Chef eigentlich, dass Du Spitze bist??? Wenn nicht, grüße ihn von mir:)

              Vielen Dank, das war es. Ja, irgendwie muss man ja dahinter kommen, auch bei der Runtime. Habe den Inhalt einfach in ein sichtbares Testfeld geschrieben, das muss nun nur wieder weg.

              Schönes WE

            • #16350
              Klaus Major
              Administrator

                Gern geschehen, aber ich bin seit vielen Jahren arbeitslos und das Jobcenter hat keine Ahnung von nix, geht mir allerdings auch glücklicherweise nicht auf den Sack! 😎

            Ansicht von 4 Antwort-Themen
            • Du musst angemeldet sein, um auf dieses Thema antworten zu können.