By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,435 Members | 2,033 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,435 IT Pros & Developers. It's quick & easy.

Images inline with blog contents - HOW??

P: n/a
I am seeking to hand-roll my own blog in ASP.NET 2.0 and SQLExpress
2005. Why? Because I can. Because I will gain experience.

The one thing that has me stumped at square one is inline images. That
is, images inline with the actual content of the blog itself. Is there
an example that I can be pointed to, where I can examine some code and
figure out how to do this? Frankly I haven't got a clue, aside from
breaking the content up into multiple chunks so that the images can be
interleaved with the content. And that just doesn't sound very elegant
at all (it offends my design sensibilities).

TIA
...Geshel
--

************************************************** *********************
* My reply-to is an automatically monitored spam honeypot. Do not use *
* it unless you want to be blacklisted by SpamCop. Please reply to my *
* first name at my last name dot org. *
************************************************** *********************
“Anyone who believes in Intelligent Design (“creationism”) is just as ignorant and ill-educated as someone who believes thatthe world is flat, that the Sun circles the Earth or that there really is a tooth fairy. Darwinism has an overwhelming foundation of evidence that can be tested and reproduced. Intelligent Design, on the other hand, has no evidence at all; not one single shred of testable proof. As such, Intelligent Design is Religious Mythology, and has no right whatsoever to be in our Science classrooms.” - 99.99+% of Scientists
************************************************** *********************
Mignon McLaughlin once said that “A nymphomaniac is a woman [who is] as obsessed with sex as the average man.” Unfortunately, since true nymphomaniacs are so rare, this means that it takes an extraordinary woman to keep up with an ordinary man.
************************************************** *********************

Jan 13 '06 #1
Share this Question
Share on Google+
10 Replies


P: n/a
Neo Geshel wrote:
I am seeking to hand-roll my own blog in ASP.NET 2.0 and SQLExpress
2005. Why? Because I can. Because I will gain experience.


I am replying from .inetserver.asp.db.
I am puzzled about why you included us in your crosspost: your question
seems to have nothing to do with db's (databases).

Moreover, there was no way for you to know it, but the .inetserver.asp
groups are for classic asp questions.
Given the relevant groups you included in your crosspost, I'm sure you will
get many helpful replies from them. I just hope the respondants think to
remove .inetserver.asp.db from their replies.
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Jan 13 '06 #2

P: n/a
> The one thing that has me stumped at square one is inline images. That
is, images inline with the actual content of the blog itself. Is there
an example that I can be pointed to, where I can examine some code and
figure out how to do this? Frankly I haven't got a clue, aside from
breaking the content up into multiple chunks so that the images can be
interleaved with the content. And that just doesn't sound very elegant
at all (it offends my design sensibilities).


The easiest way to do it simply would probably be to put some textual
placeholder in the content in place of images, including a unique
identifier, and then do a Replace on the content before displaying the
relevant entry to substitute in an <img... tag instead of the
placeholder; the 'src' for that could point to an ASP.NET page that
gets the correct image out of a binary column in the database.

Jan 13 '06 #3

P: n/a
A blog is an HTML document on the client. As such, it has no images in it.
It is pure text. It has image tags in it, which contain references to the
location of the image. The browser downloads the image from the server and
formats it in the browser, according to the HTML and CSS in the page.

Therefore, if one wants to incorporate an image into a blog entry, it either
has to be on the server, be on another server (with an absolute URL pointing
to it), or be uploaded to the server. Since when one is entering an entry
into a blog, it is going to be displayed as HTML in an HTML document, how
this is accomplished depends largely upon the interface used to create the
blog entry.

Of course, I have no idea what sort of interface you're designing. I would
suspect that it will be an ASP.Net form. If your interface has a textarea in
it into which you type the content, it must be processed in some way in
order to be rendered correctly in an HTML document. This means that line
breaks must be translated into <br> tags, and a few other things, depending
upon your requirements.

You may decide to allow inline HTML to be entered into the text, so as to be
able to render it in the HTML document. If this is the case, and you are
referencing an image that is already on *a* web server, you could simply
type in the HTML for the image tag. On the other hand, if you want to upload
the image to the server, you would need to include an input type="file"
element in the form, and handle the upload to the server.

Of course, you would also have to position the image in the text afterwards.
How you do this is up to you again, as you are developing your own
interface. It could be as simple as I described earlier, or as complex as
allowing the user to drag and drop the image in the page, using DHTML to
position it dynamically.

The bottom line to all this is that, regardless of what it looks like in a
browser, things aren't always what they seem; a blog entry is an HTML
document, and when you create an app for creating blog entries, you are
creating an HTML editor. If you aren't very familiar with HTML at this
point, it would behoove you to become familiar with it. or just forget about
including any images or formatting.

BTW, I believe in Intelligent Design. So, you might not want to believe
anything I say, since I am as ignorant and ill-educated as someone who
believes the world is flat, that the Sun circles the Earth or that there
really is a tooth fairy. But I don't cross-post.

--
;-),

Kevin Spencer
Microsoft MVP
..Net Developer
You can lead a fish to a bicycle,
but it takes a very long time,
and the bicycle has to *want* to change.

"Neo Geshel" <go****@geshel.org> wrote in message
news:zeTxf.213044$2k.151228@pd7tw1no...
I am seeking to hand-roll my own blog in ASP.NET 2.0 and SQLExpress
2005. Why? Because I can. Because I will gain experience.

The one thing that has me stumped at square one is inline images. That
is, images inline with the actual content of the blog itself. Is there
an example that I can be pointed to, where I can examine some code and
figure out how to do this? Frankly I haven't got a clue, aside from
breaking the content up into multiple chunks so that the images can be
interleaved with the content. And that just doesn't sound very elegant
at all (it offends my design sensibilities).

TIA
....Geshel
--

************************************************** *********************
* My reply-to is an automatically monitored spam honeypot. Do not use *
* it unless you want to be blacklisted by SpamCop. Please reply to my *
* first name at my last name dot org. *
************************************************** *********************
"Anyone who believes in Intelligent Design ("creationism") is just as
ignorant and ill-educated as someone who believes that the world is flat,
that the Sun circles the Earth or that there really is a tooth fairy.
Darwinism has an overwhelming foundation of evidence that can be tested and
reproduced. Intelligent Design, on the other hand, has no evidence at all;
not one single shred of testable proof. As such, Intelligent Design is
Religious Mythology, and has no right whatsoever to be in our Science
classrooms." - 99.99+% of Scientists
************************************************** *********************
Mignon McLaughlin once said that "A nymphomaniac is a woman [who is] as
obsessed with sex as the average man." Unfortunately, since true
nymphomaniacs are so rare, this means that it takes an extraordinary woman
to keep up with an ordinary man.
************************************************** *********************
Jan 13 '06 #4

P: n/a
Kevin Spencer wrote:
A blog is an HTML document on the client. As such, it has no images in it.
It is pure text. It has image tags in it, which contain references to the
location of the image. The browser downloads the image from the server and
formats it in the browser, according to the HTML and CSS in the page.
A blog... as an HTML document on the client? Well, all “web content”
ends up as this eventually... I guess. The point is, I have seen blog
entries (blogger.com comes to mind) where the blogger had “interleaved”
text and images in their blog entry. This is something I haven’t seen
before, and I have never seen a code example that shows how to do this.
I also do not have access to a blog account on blogger.com, so I haven’t
seen their interface or how they might allow a user to do this.
Therefore, if one wants to incorporate an image into a blog entry, it either
has to be on the server, be on another server (with an absolute URL pointing
to it), or be uploaded to the server. Since when one is entering an entry
into a blog, it is going to be displayed as HTML in an HTML document, how
this is accomplished depends largely upon the interface used to create the
blog entry.
From what I know, Blogger.com stores everything in a database
(including images)... but how to do this without breaking up the text
from a single blog entry into multiple pieces? Clearly, the server needs
to know how to “insert” an image into the correct place, and the only
way I can currently come up with is to have the text broken up (the
breaks where an image is supposed to go), and a “meta-field” db category
that spells out the sorting order of the text blocks and the images
(text-image-text-image-image-text, etc.) for each blog entry.
Of course, I have no idea what sort of interface you're designing. I would
suspect that it will be an ASP.Net form. If your interface has a textarea in
it into which you type the content, it must be processed in some way in
order to be rendered correctly in an HTML document. This means that line
breaks must be translated into <br> tags, and a few other things, depending
upon your requirements.

You may decide to allow inline HTML to be entered into the text, so as to be
able to render it in the HTML document. If this is the case, and you are
referencing an image that is already on *a* web server, you could simply
type in the HTML for the image tag. On the other hand, if you want to upload
the image to the server, you would need to include an input type="file"
element in the form, and handle the upload to the server.
I intend to have *everything* handled by my SQL server. That way, I
don’t have to worry about stray uploaded images clogging up the file
system, or file name conflicts, or any number of other headaches that
crop up when images are *not* stored in a database. Since this is going
to be a small, personal site, I just won’t have many of the issues that
sites that use images-extracted-from-databases have, so I’m not
concerned about them.
Of course, you would also have to position the image in the text afterwards.
How you do this is up to you again, as you are developing your own
interface. It could be as simple as I described earlier, or as complex as
allowing the user to drag and drop the image in the page, using DHTML to
position it dynamically.

The bottom line to all this is that, regardless of what it looks like in a
browser, things aren't always what they seem; a blog entry is an HTML
document, and when you create an app for creating blog entries, you are
creating an HTML editor. If you aren't very familiar with HTML at this
point, it would behoove you to become familiar with it. or just forget about
including any images or formatting.
I have over 10 years of direct web experience, as I use XHTML 1.1 and
CSS 2.1 to create web sites that are 100% accessible. I have been using
SQL Server, ASP and ASP.NET for the last several years, and am leaping
at the opportunity to use ASP.NET 2.0 (for its XHTML 1.1 compliance).
The problem is, I have never been able to examine code (and its
accompanying database structure) that could take text and images (both
of which are stored in the database) and interleave them.

The only logical method that I have been able to think of is the one in
my first paragraph above, where the text is broken up before it is even
put into the database, so that the images can be “interleaved” with it
more effectively. This, however, requires a “tracking” table, which
tracks the order of text and images so that it can be properly assembled
in the post. That way, you can upload text and images to create the
following post: text-image-text-image-image-text-image, but the problem
with this method is that it is very inelegant. It is a *very* messy way
of doing it, and is the design equivalent to building a car-sized Rube
Goldberg contraption whose entire purpose is just to pick your nose in a
certain way.
BTW, I believe in Intelligent Design. So, you might not want to believe
anything I say, since I am as ignorant and ill-educated as someone who
believes the world is flat, that the Sun circles the Earth or that there
really is a tooth fairy.
Belief in Intelligent Design is not a breakdown of intelligence. It is,
however, a direct result of a severe lack of decent scientific
education, as well as an inability to critically examine the world in a
logical, rational way (the Scientific Method) and see things for how
they really are. Simply put, Intelligent Design fails all three basic
requirements of Science: to be testable, to make testable predictions,
and to provide clear guidelines and examples on how it can be proven
wrong (that is, to be able to be disproven). Therefore, I.D. simply
isn’t Science. It is Religious Mythology, and nothing more.

Let’s keep this post on-topic; e-mail me if you want a debate.
But I don't cross-post.


Yes, but what would you rather see me do: cross-post, or multi-post? Me,
I’d rather do the lesser of two evils, and cross-post.

...Geshel
--
************************************************** *********************
* My reply-to is an automatically monitored spam honeypot. Do not use *
* it unless you want to be blacklisted by SpamCop. Please reply to my *
* first name at my last name dot org. *
************************************************** *********************
“Anyone who believes in Intelligent Design (“creationism”) is just as
ignorant and ill-educated as someone who believes that the world is
flat, that the Sun circles the Earth or that there really is a tooth
fairy. Darwinism has an overwhelming foundation of evidence that can be
tested and reproduced. Intelligent Design, on the other hand, has no
evidence at all; not one single shred of testable proof. As such,
Intelligent Design is Religious Mythology, and has no right whatsoever
to be in our Science classrooms.” - 99.99+% of Scientists
************************************************** *********************
Mignon McLaughlin once said that “A nymphomaniac is a woman [who is] as
obsessed with sex as the average man.” Unfortunately, since true
nymphomaniacs are so rare, this means that it takes an extraordinary
woman to keep up with an ordinary man.
************************************************** *********************
Jan 13 '06 #5

P: n/a
Bob Barrows [MVP] wrote:
Neo Geshel wrote:
I am seeking to hand-roll my own blog in ASP.NET 2.0 and SQLExpress
2005. Why? Because I can. Because I will gain experience.

I am replying from .inetserver.asp.db.
I am puzzled about why you included us in your crosspost: your question
seems to have nothing to do with db's (databases).


Actually, most blogs are served up from databases, as will be mine
(SQLExpress 2005), so it is entirely on-topic.
Moreover, there was no way for you to know it, but the .inetserver.asp
groups are for classic asp questions.
I know. But you guys have probably been making db-enabled web apps for
the longest time, so you’ll have the most experience and might know how
to do what I’m looking to do. *That’s* what I’m looking for.
Given the relevant groups you included in your crosspost, I'm sure you will
get many helpful replies from them. I just hope the respondants think to
remove .inetserver.asp.db from their replies.


And I don’t really care about any replies being about classic ASPor
current ASP.NET. The point is, I’m looking for some examples (in any
kind of code, actually), that would allow me to create the effect that I
am looking for.

...Geshel
--
************************************************** *********************
* My reply-to is an automatically monitored spam honeypot. Do not use *
* it unless you want to be blacklisted by SpamCop. Please reply to my *
* first name at my last name dot org. *
************************************************** *********************
“Anyone who believes in Intelligent Design (“creationism”) is just as
ignorant and ill-educated as someone who believes that the world is
flat, that the Sun circles the Earth or that there really is a tooth
fairy. Darwinism has an overwhelming foundation of evidence that can be
tested and reproduced. Intelligent Design, on the other hand, has no
evidence at all; not one single shred of testable proof. As such,
Intelligent Design is Religious Mythology, and has no right whatsoever
to be in our Science classrooms.” - 99.99+% of Scientists
************************************************** *********************
Mignon McLaughlin once said that “A nymphomaniac is a woman [who is] as
obsessed with sex as the average man.” Unfortunately, since true
nymphomaniacs are so rare, this means that it takes an extraordinary
woman to keep up with an ordinary man.
************************************************** *********************
Jan 13 '06 #6

P: n/a
Paul Henderson wrote:
The one thing that has me stumped at square one is inline images. That
is, images inline with the actual content of the blog itself. Is there
an example that I can be pointed to, where I can examine some code and
figure out how to do this? Frankly I haven't got a clue, aside from
breaking the content up into multiple chunks so that the images can be
interleaved with the content. And that just doesn't sound very elegant
at all (it offends my design sensibilities).



The easiest way to do it simply would probably be to put some textual
placeholder in the content in place of images, including a unique
identifier, and then do a Replace on the content before displaying the
relevant entry to substitute in an <img... tag instead of the
placeholder; the 'src' for that could point to an ASP.NET page that
gets the correct image out of a binary column in the database.


That is a great way of doing that, but only if the images were *not*
stored in a database. Unfortunately, mine will be, so how do I create a
placeholder that can automatically reference the correct image?

I guess a simple text placeholder (such as “[image=db]”) could be parsed
when it is extracted from the database (most of my text formatting is
parsed in the same way... [b] is turned into <b>, etc.), so that it ends
up being “<img src="/showimage.aspx?db=blogimages&amp;entry=20050113"
alt="" />”, but if I make use of multiple images inside of a single blog
post, how will I be able to know ahead of time which primary key value
each image will have?

...Geshel
--
************************************************** *********************
* My reply-to is an automatically monitored spam honeypot. Do not use *
* it unless you want to be blacklisted by SpamCop. Please reply to my *
* first name at my last name dot org. *
************************************************** *********************
“Anyone who believes in Intelligent Design (“creationism”) is just as
ignorant and ill-educated as someone who believes that the world is
flat, that the Sun circles the Earth or that there really is a tooth
fairy. Darwinism has an overwhelming foundation of evidence that can be
tested and reproduced. Intelligent Design, on the other hand, has no
evidence at all; not one single shred of testable proof. As such,
Intelligent Design is Religious Mythology, and has no right whatsoever
to be in our Science classrooms.” - 99.99+% of Scientists
************************************************** *********************
Mignon McLaughlin once said that “A nymphomaniac is a woman [who is] as
obsessed with sex as the average man.” Unfortunately, since true
nymphomaniacs are so rare, this means that it takes an extraordinary
woman to keep up with an ordinary man.
************************************************** *********************
Jan 13 '06 #7

P: n/a
Hi Neo,
From what I know, Blogger.com stores everything in a database (including
images)... but how to do this without breaking up the text from a single
blog entry into multiple pieces? Clearly, the server needs to know how to
"insert" an image into the correct place, and the only way I can currently
come up with is to have the text broken up (the breaks where an image is
supposed to go), and a "meta-field" db category that spells out the
sorting order of the text blocks and the images
(text-image-text-image-image-text, etc.) for each blog entry.
Well, storing images in a database is expensive in terms of memory and
processing involved, but you can store them however you wish. In any case,
you will still need to upload them via the browser user interface.

As to the server "inserting" an image into a page, again, that's all done
via HTML text. How it's done, I can't tell you. You're writing the app.
There are any number of ways to do it. But they all involve writing HTML and
CSS into an HTML document. Positioning images in an HTML document is not
exactly a piece of cake, especially when it comes to wrapping text around
them. But again, however you want to describe the back end, and however it
interfaces with the front end, ultimately you're writing an HTML editor.

A web-based HTML editor is a daunting task to design, especially when it
comes to mixing text and images. You may want to have a look at some of the
free code that's out there, and modify it to suit your needs. Here are a few
links if you're interested:

http://www.411asp.net/home/webapps/htmlcode
http://directory.google.com/Top/Comp.../Editors/HTML/
http://www.geniisoft.com/showcase.nsf/WebEditors
http://www.cmsreview.com/WYSIWYG/Ope...directory.html
http://www.netmag.co.uk/downloads/de...bsectionid=118
Belief in Intelligent Design ...
No, I am not interested in debate. It's a waste of my time. But I will leave
you with this thought: It takes just as much faith to DISbelieve in
something that cannot be proven as it does to believe in something that
cannot be proven. Disbelief is, after all, belief in the opposite of
something believed. True skepticism is not any form of belief.
Let's keep this post on-topic.
I will if you will! ;-)

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
You can lead a fish to a bicycle,
but it takes a very long time,
and the bicycle has to *want* to change.

"Neo Geshel" <go****@geshel.org> wrote in message
news:HgVxf.331481$ki.289543@pd7tw2no...
Kevin Spencer wrote: A blog is an HTML document on the client. As such, it has no images in it.
It is pure text. It has image tags in it, which contain references to the
location of the image. The browser downloads the image from the server and
formats it in the browser, according to the HTML and CSS in the page.
A blog... as an HTML document on the client? Well, all "web content"
ends up as this eventually... I guess. The point is, I have seen blog
entries (blogger.com comes to mind) where the blogger had "interleaved"
text and images in their blog entry. This is something I haven't seen
before, and I have never seen a code example that shows how to do this.
I also do not have access to a blog account on blogger.com, so I haven't
seen their interface or how they might allow a user to do this.
Therefore, if one wants to incorporate an image into a blog entry, it
either has to be on the server, be on another server (with an absolute URL
pointing to it), or be uploaded to the server. Since when one is entering
an entry into a blog, it is going to be displayed as HTML in an HTML
document, how this is accomplished depends largely upon the interface used
to create the blog entry.
From what I know, Blogger.com stores everything in a database
(including images)... but how to do this without breaking up the text
from a single blog entry into multiple pieces? Clearly, the server needs
to know how to "insert" an image into the correct place, and the only
way I can currently come up with is to have the text broken up (the
breaks where an image is supposed to go), and a "meta-field" db category
that spells out the sorting order of the text blocks and the images
(text-image-text-image-image-text, etc.) for each blog entry.
Of course, I have no idea what sort of interface you're designing. I would
suspect that it will be an ASP.Net form. If your interface has a textarea
in it into which you type the content, it must be processed in some way in
order to be rendered correctly in an HTML document. This means that line
breaks must be translated into <br> tags, and a few other things,
depending upon your requirements.

You may decide to allow inline HTML to be entered into the text, so as to
be able to render it in the HTML document. If this is the case, and you
are referencing an image that is already on *a* web server, you could
simply type in the HTML for the image tag. On the other hand, if you want
to upload the image to the server, you would need to include an input
type="file" element in the form, and handle the upload to the server.
I intend to have *everything* handled by my SQL server. That way, I
don't have to worry about stray uploaded images clogging up the file
system, or file name conflicts, or any number of other headaches that
crop up when images are *not* stored in a database. Since this is going
to be a small, personal site, I just won't have many of the issues that
sites that use images-extracted-from-databases have, so I'm not
concerned about them.
Of course, you would also have to position the image in the text
afterwards. How you do this is up to you again, as you are developing your
own interface. It could be as simple as I described earlier, or as complex
as allowing the user to drag and drop the image in the page, using DHTML
to position it dynamically.

The bottom line to all this is that, regardless of what it looks like in a
browser, things aren't always what they seem; a blog entry is an HTML
document, and when you create an app for creating blog entries, you are
creating an HTML editor. If you aren't very familiar with HTML at this
point, it would behoove you to become familiar with it. or just forget
about including any images or formatting.
I have over 10 years of direct web experience, as I use XHTML 1.1 and
CSS 2.1 to create web sites that are 100% accessible. I have been using
SQL Server, ASP and ASP.NET for the last several years, and am leaping
at the opportunity to use ASP.NET 2.0 (for its XHTML 1.1 compliance).
The problem is, I have never been able to examine code (and its
accompanying database structure) that could take text and images (both
of which are stored in the database) and interleave them.

The only logical method that I have been able to think of is the one in
my first paragraph above, where the text is broken up before it is even
put into the database, so that the images can be "interleaved" with it
more effectively. This, however, requires a "tracking" table, which
tracks the order of text and images so that it can be properly assembled
in the post. That way, you can upload text and images to create the
following post: text-image-text-image-image-text-image, but the problem
with this method is that it is very inelegant. It is a *very* messy way
of doing it, and is the design equivalent to building a car-sized Rube
Goldberg contraption whose entire purpose is just to pick your nose in a
certain way.
BTW, I believe in Intelligent Design. So, you might not want to believe
anything I say, since I am as ignorant and ill-educated as someone who
believes the world is flat, that the Sun circles the Earth or that there
really is a tooth fairy.
Belief in Intelligent Design is not a breakdown of intelligence. It is,
however, a direct result of a severe lack of decent scientific
education, as well as an inability to critically examine the world in a
logical, rational way (the Scientific Method) and see things for how
they really are. Simply put, Intelligent Design fails all three basic
requirements of Science: to be testable, to make testable predictions,
and to provide clear guidelines and examples on how it can be proven
wrong (that is, to be able to be disproven). Therefore, I.D. simply
isn't Science. It is Religious Mythology, and nothing more.

Let's keep this post on-topic; e-mail me if you want a debate.
But I don't cross-post.


Yes, but what would you rather see me do: cross-post, or multi-post? Me,
I'd rather do the lesser of two evils, and cross-post.

....Geshel
--
************************************************** *********************
* My reply-to is an automatically monitored spam honeypot. Do not use *
* it unless you want to be blacklisted by SpamCop. Please reply to my *
* first name at my last name dot org. *
************************************************** *********************
"Anyone who believes in Intelligent Design ("creationism") is just as
ignorant and ill-educated as someone who believes that the world is
flat, that the Sun circles the Earth or that there really is a tooth
fairy. Darwinism has an overwhelming foundation of evidence that can be
tested and reproduced. Intelligent Design, on the other hand, has no
evidence at all; not one single shred of testable proof. As such,
Intelligent Design is Religious Mythology, and has no right whatsoever
to be in our Science classrooms." - 99.99+% of Scientists
************************************************** *********************
Mignon McLaughlin once said that "A nymphomaniac is a woman [who is] as
obsessed with sex as the average man." Unfortunately, since true
nymphomaniacs are so rare, this means that it takes an extraordinary
woman to keep up with an ordinary man.
************************************************** *********************
Jan 13 '06 #8

P: n/a
Kevin Spencer wrote:
Hi Neo,

From what I know, Blogger.com stores everything in a database (including
images)... but how to do this without breaking up the text from a single
blog entry into multiple pieces? Clearly, the server needs to know how to
"insert" an image into the correct place, and the only way I can currently
come up with is to have the text broken up (the breaks where an image is
supposed to go), and a "meta-field" db category that spells out the
sorting order of the text blocks and the images
(text-image-text-image-image-text, etc.) for each blog entry.



Well, storing images in a database is expensive in terms of memory and
processing involved, but you can store them however you wish. In any case,
you will still need to upload them via the browser user interface.

As to the server "inserting" an image into a page, again, that's all done
via HTML text. How it's done, I can't tell you. You're writing the app.
There are any number of ways to do it. But they all involve writing HTML and
CSS into an HTML document. Positioning images in an HTML document is not
exactly a piece of cake, especially when it comes to wrapping text around
them. But again, however you want to describe the back end, and howeverit
interfaces with the front end, ultimately you're writing an HTML editor.

A web-based HTML editor is a daunting task to design, especially when it
comes to mixing text and images. You may want to have a look at some ofthe
free code that's out there, and modify it to suit your needs. Here are a few
links if you're interested:

http://www.411asp.net/home/webapps/htmlcode
http://directory.google.com/Top/Comp.../Editors/HTML/
http://www.geniisoft.com/showcase.nsf/WebEditors
http://www.cmsreview.com/WYSIWYG/Ope...directory.html
http://www.netmag.co.uk/downloads/de...bsectionid=118


Please understand, I am *not* trying to create an on-line HTML editor. I
am looking for a way to create database tables and ASP.NET code, such
that images drawn from the database can be interleaved with text drawn
from the same database, all in a preconfigured sequence.

That is, when I create a post, I want to be able to include several
images, such that the post goes like this:

text
image
text
image
image
text

Normally, in a simple blog, the database has just one table and three or
four fields for that table (aside from the primary key): the date, the
title, the body and the category. I know I will have to create a
separate table for holding the images (to make the db normalized), but
how would I go around structuring the database so that the interleaving
above can take place? Please understand, any ASP.NET that I have to
create should be easy for me. What I am asking for is a conceptual idea
on how to create a normalized, elegant, and simple database that will
allow me to serve both text *and* images, interleaved, from the same
database.

The only really robust method that I have come up with so far involves
three tables: One for the post, one for the images, and a third for the
post text. That way, the post can reference both the text and the
images, and as such, the latter two can be interleaved as per
instructions in a “layout” field in the post table.

Instead of the above kludge, I am looking for a two-table solution. My
only other option is to have all images sitting off to one side,
separate from the body of the blog post. This is undesirable for several
reasons which I will not get into here, but I will implement that method
before I have to resort to the three-table method.

...Geshel
--
************************************************** *********************
* My reply-to is an automatically monitored spam honeypot. Do not use *
* it unless you want to be blacklisted by SpamCop. Please reply to my *
* first name at my last name dot org. *
************************************************** *********************
“Anyone who believes in Intelligent Design (“creationism”) is just as
ignorant and ill-educated as someone who believes that the world is
flat, that the Sun circles the Earth or that there really is a tooth
fairy. Darwinism has an overwhelming foundation of evidence that can be
tested and reproduced. Intelligent Design, on the other hand, has no
evidence at all; not one single shred of testable proof. As such,
Intelligent Design is Religious Mythology, and has no right whatsoever
to be in our Science classrooms.” - 99.99+% of Scientists
************************************************** *********************
Mignon McLaughlin once said that “A nymphomaniac is a woman [who is] as
obsessed with sex as the average man.” Unfortunately, since true
nymphomaniacs are so rare, this means that it takes an extraordinary
woman to keep up with an ordinary man.
************************************************** *********************
Jan 13 '06 #9

P: n/a
Hi Neo,

Well, since you've mentioned that you're not intereseted in doing anything
other than alternating text with images (if I understand you correctly), the
solution should be fairly simple (depending upon your view of what
constitutes "simple" of course!).

Again, keeping it as simple as possible, you only need the 2 tables
(although I abhor the idea of storing images in a database, but it's your
app). The images table only needs a binary field to store the image, and
perhaps a field to store the image file name. You would also want a foreign
key field to point to the blog entry record that the image is associated
with.

For your interface, you will still need an image upload form. How this form
is structured is going to be up to you, but it sounds like you might want to
upload multiple images with a single blog entry. If so, you will need
multiple file upload elements in the page. You may want to be able to
dynamically add them, but that's going to entail a bit more programming
skill. Let's leave that alone for now, and get to how the image is
referenced in the blog entry.

The simplest solution I can think of for this is to use some sort of
convention in the text of the blog entry, where you want the image to
appear. Now, let's assume for the sake of simplicity that you will have
enough file upload fields to handle however many images you are putting in.
All you would need then is some sort of token in the text to indicate that
an image goes in there. Example:

Lorem ipsum dolor sit amet, consectetuer adipiscing elit. [img]Quisque in
risus sit amet ante ornare tincidunt. Pellentesque ac nisl vitae sapien
pharetra aliquet. Donec orci risus, tincidunt pellentesque, facilisis id,
consequat non, lorem. Aenean eget nunc. Sed ligula nulla, congue in,
condimentum vitae, elementum nec, odio. [img]Nullam quam. Aliquam eu lectus.
Nunc tristique. Nulla iaculis. Donec non metus sagittis massa facilisis
rhoncus. [img]Donec massa risus, convallis et, tincidunt non, dignissim ut,
ante. Nullam eleifend. Cras molestie justo vitae nibh. Mauris ultrices
pellentesque velit. Duis ipsum eros, mollis quis, tempus et, iaculis at,
arcu. Nunc non mi.

Note the [img] tokens in the text. This would be stored in the database as
part of the text. The images will appear in the form in the order in which
you put them, so the first image would replace the first token, the second
would replace the second, and so on. Now, you have a choice here as to how
to enumerate the images according to their position in the blog entry. One
would be to use the image file name in the token, as in [file1.jpg]. The
other would be to use a numeric column to store the order in the database.

As to how the images get included in the HTML output, first, you would need
to replace the tokens in the text with a URL of an ASP.Net page that will
return an image. You can use a single ASP.Net page to do this, and use a
querystring to identify the image being displayed, as in
"/images/image.aspx?id=123." In the page that contains the blog entry, there
would be an image tag for each image, something like: <img
src=""/images/image.aspx?id=123"> . The ASP.Net page that returns the image
would read the querystring, and fetch the image from the database, setting
the Response.ContentType to "image/jpg" and writing the image back to the
Response.OutputStream. In a sense, the ASP.Net page would *be* the image.
Let me know if you need more information about how to do this.

How does that sound for a solution?

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
You can lead a fish to a bicycle,
but it takes a very long time,
and the bicycle has to *want* to change.

"Neo Geshel" <go****@geshel.org> wrote in message
news:P_Vxf.214527$2k.72330@pd7tw1no...
Kevin Spencer wrote:
Hi Neo,

From what I know, Blogger.com stores everything in a database (including
images)... but how to do this without breaking up the text from a single
blog entry into multiple pieces? Clearly, the server needs to know how to
"insert" an image into the correct place, and the only way I can currently
come up with is to have the text broken up (the breaks where an image is
supposed to go), and a "meta-field" db category that spells out the
sorting order of the text blocks and the images
(text-image-text-image-image-text, etc.) for each blog entry.

Well, storing images in a database is expensive in terms of memory and
processing involved, but you can store them however you wish. In any case,
you will still need to upload them via the browser user interface.

As to the server "inserting" an image into a page, again, that's all done
via HTML text. How it's done, I can't tell you. You're writing the app.
There are any number of ways to do it. But they all involve writing HTML
and CSS into an HTML document. Positioning images in an HTML document is
not exactly a piece of cake, especially when it comes to wrapping text
around them. But again, however you want to describe the back end, and
however it interfaces with the front end, ultimately you're writing an
HTML editor.

A web-based HTML editor is a daunting task to design, especially when it
comes to mixing text and images. You may want to have a look at some of
the free code that's out there, and modify it to suit your needs. Here are
a few links if you're interested:

http://www.411asp.net/home/webapps/htmlcode
http://directory.google.com/Top/Comp.../Editors/HTML/
http://www.geniisoft.com/showcase.nsf/WebEditors
http://www.cmsreview.com/WYSIWYG/Ope...directory.html
http://www.netmag.co.uk/downloads/de...bsectionid=118


Please understand, I am *not* trying to create an on-line HTML editor. I
am looking for a way to create database tables and ASP.NET code, such
that images drawn from the database can be interleaved with text drawn
from the same database, all in a preconfigured sequence.

That is, when I create a post, I want to be able to include several
images, such that the post goes like this:

text
image
text
image
image
text

Normally, in a simple blog, the database has just one table and three or
four fields for that table (aside from the primary key): the date, the
title, the body and the category. I know I will have to create a
separate table for holding the images (to make the db normalized), but
how would I go around structuring the database so that the interleaving
above can take place? Please understand, any ASP.NET that I have to
create should be easy for me. What I am asking for is a conceptual idea
on how to create a normalized, elegant, and simple database that will
allow me to serve both text *and* images, interleaved, from the same
database.

The only really robust method that I have come up with so far involves
three tables: One for the post, one for the images, and a third for the
post text. That way, the post can reference both the text and the
images, and as such, the latter two can be interleaved as per
instructions in a "layout" field in the post table.

Instead of the above kludge, I am looking for a two-table solution. My
only other option is to have all images sitting off to one side,
separate from the body of the blog post. This is undesirable for several
reasons which I will not get into here, but I will implement that method
before I have to resort to the three-table method.

....Geshel
--
************************************************** *********************
* My reply-to is an automatically monitored spam honeypot. Do not use *
* it unless you want to be blacklisted by SpamCop. Please reply to my *
* first name at my last name dot org. *
************************************************** *********************
"Anyone who believes in Intelligent Design ("creationism") is just as
ignorant and ill-educated as someone who believes that the world is
flat, that the Sun circles the Earth or that there really is a tooth
fairy. Darwinism has an overwhelming foundation of evidence that can be
tested and reproduced. Intelligent Design, on the other hand, has no
evidence at all; not one single shred of testable proof. As such,
Intelligent Design is Religious Mythology, and has no right whatsoever
to be in our Science classrooms." - 99.99+% of Scientists
************************************************** *********************
Mignon McLaughlin once said that "A nymphomaniac is a woman [who is] as
obsessed with sex as the average man." Unfortunately, since true
nymphomaniacs are so rare, this means that it takes an extraordinary
woman to keep up with an ordinary man.
************************************************** *********************
Jan 13 '06 #10

P: n/a
Neo,

I know how one image can be placed from a database in a webpage. Not more.

I only created this once when somebody said that it could not be done.

While I changed it than because of that the Northwind database has an ole
image format, and than again to show how to make first a thumbnail from it.

http://groups.google.com/group/micro...6cba49dcca34dc

I hope this helps,

Cor

Jan 14 '06 #11

This discussion thread is closed

Replies have been disabled for this discussion.