Image als Bin[] aus MSSQL-DB

Michael Graf <[email protected]>
Newsgroups gmane.comp.web.zope.german
Message-ID <[email protected]>
Hallo,
ich versuche gerade aus eine MSSQL-Datenbank Daten anzuzeigen - es funktioniert auch soweit, jetzt muss ich auch ein Bild das als "Binary" in der Datenbank abgelegt ist anzeigen.

Ich glaube auch - bin mir nicht sicher, da der Original-Programmierer nicht im Haus ist - dass die Bilder als Byte[] gespeichert werden.

Im Moment sieht es so aus:

    def ProjectsImage(self, projectId=None, width=128, height=128):
        """
        return project image file
        """

        db = create_engine('mssql+pyodbc://user:pass@SERVER/DB')
        connection = db.connect()
        results = connection.execute('SELECT Projektbild FROM Projektebilder WHERE ProjektID =' + str(projectId)).fetchone()

        response = self.request.response
        response.data = StringIO.StringIO(results['Projektbild'])
        response.headers['Content-Type'] = 'image/jpg'
        return response

Ergebnis:
Bild kann nicht angezeigt warden, will sie Fehler enthält.

ProjectsImage ist in einer browserView gespeichert..


Plone 4.0.5
Zope 2.12.17
Python 2.6.6
Sqlalchemy 0.6.7

Michael Graf
Webmaster

IMC Fachhochschule Krems
University of Applied Sciences Krems
Piaristengasse 1, A-3500 Krems, Austria, Europe

Office:
Am Campus Krems, Trakt G, Raum 4.08
T: +43-(0)2732-802- ext. 519
F: +43-(0)2732-802-4
E: [email protected]
I: http://www.fh-krems.ac.at

P Bitte nur ausdrucken, wenn es wirklich nötig ist.



________________________________

Diese Nachricht erhalten Sie von einem IMC Mitarbeiter.
Allfallige angehängte Dokumente sind vertraulich und nur für den/die Adressaten bestimmt. Sollten Sie nicht der beabsichtigte Adressat sein, ist jede Offenlegung, Weiterleitung oder sonstige Verwendung dieser Information nicht gestattet. In diesem Fall bitten wir, den Absender zu verstandigen und die Information zu vernichten. Für Übermittlungsfehler oder sonstige Irrtumer bei Übermittlung besteht keine Haftung.

This message is being transmitted by an IMC employee.
Any attached files are confidential and intended solely for the addressee(s). Any publication, transmission or other use of the information by a person or entity other than the intended addressee is prohibited. If you receive this in error please contact the sender and delete the material. The sender does not accept liability for any errors or omissions as a result of the transmission.

Informationspflicht nach §14 UGB:

IMC Fachhochschule Krems GmbH
Piaristengasse 1, A-3500 Krems
Austria, Europe
ATU: 37552304
Firmenbuchnummer: 79297 p
Firmenbuchgericht: Landesgericht Krems an der Donau
DVR: 0798771
Fachgruppe Unternehmensberatung



_______________________________________________
zope mailing list
[email protected]
https://mail.dzug.org/mailman/listinfo/zope
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.