Jump to content

Images in a Blog


Konnor

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]
Link to comment
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
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.