php - How to link images with records from the database? -
my site having profiles, each profile has few images. users upload images themselves. need link images disk , profiles in mysql table. tell me best way realize functionality more flexibility?
ps i'm using codeigniter 2 + mysql.
as using codeigniter. assume using file uploading class.
after successful completion of upload, can use
$this->upload->data()
which returns array contains data related upload. example array
array ( [file_name] => mypic.jpg [file_type] => image/jpeg [file_path] => /path/to/your/upload/ [full_path] => /path/to/your/upload/jpg.jpg [raw_name] => mypic [orig_name] => mypic.jpg [client_name] => mypic.jpg [file_ext] => .jpg [file_size] => 22.2 [is_image] => 1 [image_width] => 800 [image_height] => 600 [image_type] => jpeg [image_size_str] => width="800" height="200" )
its better store these details database, along user id image belongs. , when want retrieve images, make query user id = someint ..
i think solution better storing images in db.
Comments
Post a Comment