List:General Discussion« Previous MessageNext Message »
From:Michael Dykman Date:October 15 2009 8:54pm
Subject:Re: Inserting an Image
View as plain text  
Victor,

again, your question has more to do with python usage than MySQL
per-se..  you would be better off pursuing these questions in a python
forum.

 - michael dykman

On Thu, Oct 15, 2009 at 3:28 PM, Gavin Towey <gtowey@ffn.com> wrote:
> "Image in string form"  sounds like you're not inserting binary data, rather some sort of encoded data.  Even if it is binary, you'll have to escape at least end quote characters, you can see clearly at the top of your data there is :
> 'ÿØÿà JFIF ÿÛC "" $(4,$&1'
>
>
> Another thing to think about is storing image data directly in a database is often not a good idea. See these links for more info:
>
> http://mysqldump.azundris.com/archives/36-Serving-Images-From-A-Database.html and http://hashmysql.org/index.php?title=Storing_files_in_the_database
>
> Regards,
> Gavin Towey
>
> -----Original Message-----
> From: Victor Subervi [mailto:victorsubervi@gmail.com]
> Sent: Thursday, October 15, 2009 12:05 PM
> To: mysql@stripped
> Subject: Inserting an Image
>
> Hi;
> I have successfully inserted images, like yesterday, before into MySQL with
> the following code:
>
>     1
>      cursor.execute(sql)
> where pic1 is simply an image uploaded through a form then sent over without
> any alteration to another (python) script that uploads it.  Printing it out
> looks like this (other variables included):
>
> update productsX set Name=%s, Title=%s, Description=%s, Price=%s,
> Bedrooms=%s, Bathrooms=%s, Conditions=%s, Acreage=%s, Construction=%s,
> Location=%s, Estate=%s, Address=%s, Furnished=%s, pic1=%s, pic2=%s, pic3=%s,
> pic4=%s, pic5=%s, pic6=%s where ID=%s;', ('name1', 'title1', 'descr1',
> '1.1', '2', '1', 'New', '1.5', 'New', 'arbor', 'abor', 'abor', 'Furnished',
> 'ÿØÿà JFIF 777777777777777777777777777777777777777777ÿÀ y| " ÿÄ ÿÄM !1A Qa "qs
> ³ 27Bbc‚ #46Rrt‘¡±² $'3C’%5DTUƒ“¢£ÑñÿÄ ÿÄ ÿÚ
?œ*‹RP’¥¨% d’pªÔcµkä«”øZ Âá îj
> Xêxö, `ú@$ý <%60ú@$ý> ôM¡·¢&T ‘œ¬ ºâ
> “ñ â1Ò¶¶KT[%¦-² {‘£6 Ô÷“âNI=äÒfÓ
ø/RhËîR”³q1 QüÇ“ƒŸ ƒE ë}……áRTdH ó
> Á#ÐU“ö*DÙõ¨Yt]ž îêÑ +p}5ùêÿ¹F † vã
Êöy5Ô‚\ˆëO Žc
'ö(Óõku-´^4õÊÚ Ú£8Ðð%$ ì84
> Ú*ø G¥­·T Vû#µc æ ·uÏ; Ö"ÓusN\\Ü‹5{ÑʸvoòÝû@
é ¼×CP U
> ¤¡%KPJR2I8T+´½¨®{ß{:)kzD‡; &2~1' ¤“
ïÙßA¶Õº®íª5 Ñú AiMçá ’O ’8 •tÆpHâNÇ
> Uºl¤Ûmë¸é‡Î^8$} ä í=i² Aj ©ôœ «‰J_u
> /¥<ƒ‰%*áÓÜî
>
íP]›q’Üx̧yn8pÿ߇3IP5–¨¿´©úgL2 ¦0 ?ÌU]B
> r + ç\»]_"éŸ pTŒŸXU] Èò ­
“¬gK ®tTxò^i‰ É 4‡ Rè ¤ à8
Y«›` üM ]ߊ󌼱͡§SÀ
›«¿éˆÈॠÆ[
;ô‡Qן~4»vÒOܬðu ”ëÐÙ Ë
> %®a d“Ÿ g ¨Ãe1. õõœÛ
æû2  „†Xho8é ÷G‡yÀâ8ñ
‡¤õ5ëQ¥‰Ÿ{žCjxo7"LÑÚ­ à ØG#Ú‡ ‘ž¨ t
> –›-LjFžhÈÂXy¥(… \8) ŽJð} -ÜKp¬’ T–PÔu œî
€“Œ ” ôTc¢ö…§íZ Ò«õùµMì
h‚µ<öwŽ7€É
> 1Î’šÛ2­7 ó ";= & b*Sê e Æ7xž|p
è:@Ö[YÓÚq.1 Ñs¸'Š•vq±è–bÍÏR†æ\
ˆÃÎiƒãùê °tÏ A‡§4 ”6€ ”$`$ @ ‚½t¢ƒˆ_Bš}Æ×
ä(¥Yç k®vqyM”êüÅùéýÊ
ñ÷?jÔÛ®¯iÙ®nÇœ­øÅG‚^
ˆö„â3å2º}ZjþÙ¾M/_ ß½E
t_Ä™õiþ °ÖZogV÷ m qŽ¾´¤
¼:°2zð律¿‰³êÓü)/bC
> 7¶ Ë´ ß.€Ò ÿJ:ÛÕÀ÷J«ZÍá
i:9ò•(5 ಔŽ' ƒŠYf Õ‘ ºØ‚ ê¬
½Ô±"T‰Kß’û¯+½Å•
ßSV8J ’¢£à :~Ùö˦ê‰Ó
¹H6æ 8–ä6¤ öñ Ýð :ž]ƦM
>
Zíñ´%®lxqÛ”ûJ/>†ÀZüõsW3Ê«³ÒF©Öé<…Ñ'ö¢
ƒKi[6•…äÖhik{
£ªóœt÷©\Ï_Pöl¡Ö4m¹à§w
I¸:8„Ÿ£Èîô ø‘º Í
t¢‚
> û¢t–˜š–*2 ix †r…
i)ÏèÔ Ë®0ò ejmÆÔ …¤à¤Ž ƒß]«r ë
E¾sIz4†Ën¶z¤ÿ Mr¶Ñt ý
> r)XSö×T|šVï ôUÜ¡ûù
‘lÚÑ:Æû ]x¡7 Ò¤·1lc;6½z¶ýê(
bþ&Ï«O𤽉üœ[}cþùtç
b ‡ Ó?é ®™9Úž²çýÄ
ŸVkΫùTÐÞ® ¹
÷¶¿“k¯^[¨öÏ}òV·íÚr2ÂœJx„þ‘ùî
ƒ ý¤Î–[L+
> ²=¶ØÂYŠÂwP‘ûÉ=I™­ŒÍ!aÓ»IÑŒZ-­0ÓÞZ§BŠœß)g)'xžGˆ©1‹d(÷ 7
c6‰’’„¾ð rÂF Ud[aI
> sñ›rTMÿ'uCÎo|aXôŽ
[iù5¼qèÏ·ðȦ¹ ê> ¨õáA“E P QE H»QÙë Ò ^Œ[bï
> $0ò‡ Ïq~ â BOy§ª(8®óg¸Øç. Ú#±d
ñCƒŸˆ<ˆñ *FûŸ,
> Ÿª(¢€¢Š( (¢€¢©U (ªUh
(¢ƒÿÙ', '', '',
> '', '', '', '')
>
> MySQL complains about the image in string form. I'm sure the solution is
> simple, but I don't know what it is.
>  TIA,
> Victor
>
> The information contained in this transmission may contain privileged and confidential information. It is intended only for the use of the person(s) named above. If you are not the intended recipient, you are hereby notified that any review, dissemination, distribution or duplication of this communication is strictly prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message.
>



-- 
 - michael dykman
 - mdykman@stripped

Don’t worry about people stealing your ideas. If they’re any good,
you’ll have to ram them down their throats!

   Howard Aiken
Thread
Inserting an ImageVictor Subervi15 Oct
  • Re: Inserting an Imagejoao15 Oct
  • RE: Inserting an ImageGavin Towey15 Oct
    • Re: Inserting an ImageMichael Dykman15 Oct
      • Re: Inserting an ImageVictor Subervi16 Oct