navigation
a webmaster learning community
     Home    Register     Search      Help      Login    
Sponsors

Shopping Cart Software
Ecommerce software integrated into Frontpage, Dreamweaver and Golive templates. No monthly fees and available in ASP and PHP versions.

Website Templates
We also have a wide selection of Dreamweaver, Expression Web and Frontpage templates as well as webmaster tools and CSS layouts.

Frontpage website templates
Creative Website Templates for FrontPage, Dreamweaver, Flash, SwishMax

Search Forums
 

Advanced search
Recent Posts

 Todays Posts
 Most Active posts
 Posts since last visit
 My Recent Posts
 Mark posts read

 

Inserting an image

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
Printable Version 

All Forums >> Web Development >> ASP and Database >> Inserting an image
Page: [1]
 
MCD

 

Posts: 672
Joined: 3/19/2002
From: Al USA
Status: offline

 
Inserting an image - 1/11/2008 11:49:02   
I have a site where history articles and such are viewed. I store the articles in a database and output them using the FrontPage DRW. I now would like to be able to insert a photo in some of these articles. What is the best way of doing this?

_____________________________

Author of " How To Build A Website With Duct Tape"
rdouglass

 

Posts: 9280
From: Biddeford, ME USA
Status: offline

 
RE: Inserting an image - 1/11/2008 11:51:27   
The generally accepted practice 'round here is to use a text reference to the image instead of trying to store the image directly in the database. How about adding a text field to the table and storing the filename and path there? Works well for me.

Hope it helps.

_____________________________

Don't take you're eye off your final destination.

ASP Checkbox Function Tutorial.

(in reply to MCD)
MCD

 

Posts: 672
Joined: 3/19/2002
From: Al USA
Status: offline

 
RE: Inserting an image - 1/11/2008 12:05:22   
Thanks RDouglas. I do not want to add the photo to the database. I need a way to insert some HTML pointing to the image wherever I need the image to be in the article. Does your suggestion do that?

_____________________________

Author of " How To Build A Website With Duct Tape"

(in reply to rdouglass)
rdouglass

 

Posts: 9280
From: Biddeford, ME USA
Status: offline

 
RE: Inserting an image - 1/11/2008 15:23:56   
No it doesn't - not directly.

However, I've had good luck with the Replace command in situations like this. Let me explain:

You have your text article you are putting on the page in a field I'll call "articleText". You have the full path to the image in the db as well in a field called "articleImage". So lets say we want to insert the article just before the second paragraph floated left.

In the article text itself, I'd do something like this...

<p>This is the first paragraph blah, blah....blah,blah.</p>QQQQQ<p>This is the second paragraph....</p>

Put "QQQQQ" where you wish the image to appear; in this case just before the second paragraph. Then, our *dieted* DRW code section to write the article would look something like this:

<%=Replace((FP_Field(fp_rs,"articleText")&""),"QQQQQ","<div style='margin:10px;'><img src='" & FP_Field(fp_rs,"articleImage")&"' border=0></div>")%>

Does that make any sense at all? What I'm doing is inserting an unusual string that wouldn't normally be used in an article (I used "QQQQQ" but you can use anything you want) .

Then I'm Replace'ing that string with a floated div with the image path that's stored in the articleImage field.

Be sure to note that I don't do any error checking with this so if you have QQQQQ in an article and you have nothing in the image path field, you'll probably get a red X image. If you want, check for a valid value in articleImage like

IF trim(FP_Field(fp_rs,"articleImage")&"") > "" THEN

I haven't tested anything and I'm writing from memory so I may have missed something along the way.

Hope it helps.

_____________________________

Don't take you're eye off your final destination.

ASP Checkbox Function Tutorial.

(in reply to MCD)
MCD

 

Posts: 672
Joined: 3/19/2002
From: Al USA
Status: offline

 
RE: Inserting an image - 1/11/2008 16:47:11   
Thanks, this does make sense and I appreciate your help.

_____________________________

Author of " How To Build A Website With Duct Tape"

(in reply to rdouglass)
Page:   [1]

All Forums >> Web Development >> ASP and Database >> Inserting an image
Page: [1]
Jump to: 1





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts