简体   繁体   中英

How to let users insert images inside their posts in a simple php-mysql site ??How to store the filename in mysql database?

I have 3 database tables as follows :

users -> (user_name , user_password, user_email )

posts ( post_id , user_name, post_date, post_title, post_content )

commments( comment_id , post_id , user_name , comment,ip_address )

Now I want to add the ability to embed images inside a post( and not just upload to the webserver ) . I don`t want to store the images inside the database .only their pointers?

How can this be done ? Thankx!

The easiest solution would be going for a CMS like wordpress which provides support for users/post/comments and image library, and allows you to edit and embed all kind of useful resources in posts. If you want to develop your own solution that's another story, but might prove a bit more time consuming.

You need to consider how many images,what sizes would you allow for your posts and many other aspects. Also easiest way to embed images would probably be adding <img> tags in your content. So another question would be in what format is the post_content? Pure text or HTML?

A very good example of embedding images are forum posts might want to check how those work as well.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM