Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End How to include images in blog post

  • This topic is empty.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #155559
    Anonymous
    Inactive

    I’m working on a blog and i have almost everything done. Now all i need to do is figure out a way to include images in my blog posts with php. Lets say in my admin panel i have the upload image field, were would the image go? would it go in the mysql database or in the img folder? and then do this.

    <img src="<?php echo $img_directory'"?> />
    

    but if thats acceptable, how do i send the image to the img folder without having to put it there manually myself?

    #155561
    __
    Participant

    Lets say in my admin panel i have the upload image field, were would the image go?

    typically, to your /tmp directory. You would handle the upload from whatever URL your form’s action attribute specifies.

    would it go in the mysql database or in the img folder?

    That’s up to you. The more common approach is to store the image on the filesystem, while you store the location (and other attributes) in your database. But there are advantages to storing the image itself in the DB, as well – backups, for example, and you’ll never have to worry about keeping the DB and filesystem in sync.

    <img src="<?php echo $img_directory'"?> />

    I assume $img_directory would actually be the URL to the image.

    how do i send the image to the img folder without having to put it there manually myself?

    …not sure I follow. You would have to do it yourself (how would the file “know where to go” automatically?).

    The php manual has a good section about handling file uploads.

    #155584
    Anonymous
    Inactive

    I heard that storing the images in the database is not recommended. so i want to store it in my filesystem. But i dont want to manually drag the image to the img folder. I want to click “upload image” button, select my image and thats it. The directory is applied.

Viewing 3 posts - 1 through 3 (of 3 total)
  • The forum ‘Back End’ is closed to new topics and replies.