Welcome Guest, Not a member yet? Register   Sign In
Blob Data in Oracle
#1

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?
Reply
#2

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?
Arch Book  CodeIgniter4 on Apache(pages 92-114) 
Reply




Theme © iAndrew 2016 - Forum software by © MyBB