Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Model with images
  • Hi there!

    I want to store multiple images and link them to an article. The article will be presented with the images. Normaly I would store the pathways in a serialized array in the databank and unserialized it when loading the view.
    To achieve this I would write my own Save-function for the class; checking if the files already exist, giving them proper file names and so on. Probably with many mistakes as I am fairly new to the PHP and SQL world and much newer to FuelPHP.
    My questions:
    1. How to do this? Any general hints and tipps?
    2. There would be 10ish images per article, so would a varchar(255) be feasible to hold the serialized array?
  • HarroHarro
    Accepted Answer
    The proper way would be you have an acticle_images table, which has a one-to-many relation with article, and would store the image information.

    If you use the ORM you can fetch all the information in one go:


    (assuming you have a find called 'name', and your relation to article_images is called 'images')

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion