473,320 Members | 2,071 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Re: More Fun With MySQL and Images

On Thu, 2008-04-17 at 09:52 -0500, Victor Subervi wrote:
Never mind. Apparently, these tags throw it for that loop:
print '<html><body>\n'
I´m surprised they would, but gratified I found the problem.
Victor

Why does that surprise you? A jpeg has a well-defined header that tells
whatever application is rendering it what to look for. By putting those
tags at the beginning of the data sent to your browser, you're no longer
getting a well-formed jpeg. The header is wrong.

As an experiment, if you're on *nix, or have access to a decent shell,
try this:

$ echo '<html><body>' newfile.jpg
$ cat /path/to/any_normal_jpeg >newfile.jpg
$ echo '</body></html>' >newfile.jpg

If you don't have access to a shell, open a JPEG with your favorite text
editor, and manually add "<html><body>" to the beginning, and save it
out.

Then try to open newfile in any piece of software of your choosing.
It's no longer a well-formed jpeg, so it won't work. That's exactly
what you're asking the browser to do.

I guess this isn't really python related, so my apologies for that.

Cheers,
Cliff


--
Oook,
J. Cliff Dyer
Carolina Digital Library and Archives
UNC Chapel Hill

Jun 27 '08 #1
0 555

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Jonas Meurer | last post by:
hello, i develop a project with a mysql interface. one mysql table holds all the images for my project. everything works quite well so far, except i'm not able to upload images into the...
4
by: Shaun Campbell | last post by:
I know you're going to say search the mail archives, but I have and I can't find an answer to my simple question of is there an SQL statement to load an image in a .jpg file into a database table?...
10
by: eholz1 | last post by:
Hello Members, I am setting up a photo website. I have decided to use PHP and MySQL. I can load jpeg files into the table (medium blob, or even longtext) and get the image(s) to display without...
6
by: Keith Hughitt | last post by:
Hi all, I've run into a strange error while trying to store some PNG images in a MySQL database using MySQLdb. When I try to insert smaller images (< 64kb or so) everything seems to work fine....
2
by: alieseraj | last post by:
Hi, I need to extract the images (attached) of a .EML file. Any help or ideas? Thanks in advance.
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.