Jump to content

Archived

This topic is now archived and is closed to further replies.

Konnor

Images in a Blog

Recommended Posts

I'm super new to blogging/php/mySQL and in the process of coding my own (following a tutorial from the book 'blog design solutions').

Unfortunately it doesnt show you how to add images to a blog post. Presumably you cannot directly store the image in the database, only a link to it.

Ideally I would like a setup where I may or may not have an image for each blog post. What would I put as the field in the table? How could I code it so I sometime have images in my blog post and sometimes don't?

My table currently looks like this..

[img]http://img325.imageshack.us/img325/4480/blogtablepe9.jpg[/img]

And my addpost screen looks like this

[img]http://img325.imageshack.us/img325/2518/addposttl1.jpg[/img]

Share this post


Link to post
Share on other sites
Actually, you can store images in a MySQL database if you create the field as a BLOB type.

Share this post


Link to post
Share on other sites
add a column to your table that is something like pic_url then
You could add a picture url box on your form so they could put one if they wanted...

Then when the form is processed have it put the url in the database if its a valid url...

then when displaying it if the url column doesnt equal "" you could display it in an image tag

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.