CodeIgniter Forums
Blob Data in Oracle - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28)
+--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30)
+--- Thread: Blob Data in Oracle (/showthread.php?tid=87093)



Blob Data in Oracle - gurthang75 - 03-13-2023

have a problem when trying to upload an image to an oracle database, i have the next code in my model:
PHP Code:
public function uploadImage($image$id_image){

        $builder $this->db->table('IMAGENES');
        $builder->set('B_IMAGEN'$image);
        $builder->where('id'$id_image);
        $builder->update();
    

the problem is that is giving me ORA-00972: identifier is too long.
I guess that this is for the binding method that i think its cause the binding is making with SQLT_CHR and not with SQLT_BLOB or OCI_B_BLOB
can we use something like this? and how?


RE: Blob Data in Oracle - captain-sensible - 03-14-2023

there is another approach , whic h is the way i do it. All you need in a databse to reference an image is to store its name and being to produce the path to where it is.

So i just upload images to public images ; with blogs, when i create a new blog image goes to /public/blogImages.

obviously some check needs to be made to make sure there is no attempt to upload an image that already exists. Then I can display any image in any view by retrieving image name from database relevant to some sql and display it . if its a blog sql, i know images are in b.ogImages so i get entries using model from db, then i pass to controller > I can use a for each to display all blogs ,and have a a href that can be picked up by routes and get detail For a blog article where Blog is the data handle i show in view using :

Code:
echo "   <div class =\"blog\">  <img class = \"img-fluid \"                <img src =".base_url('blogImages')."/".esc($blog['image']).">  </div>";

SO any reason to go storing actual image in db?