Welcome Guest, Not a member yet? Register   Sign In
Problem when trying to display image from database
#11

[eluser]TheFuzzy0ne[/eluser]
Oh, and I made a mistake with the variables. Mine were lowercase, but yours started with an uppercase "I". Please check out both of my proposed functions again, as I've made some modifications. But remember, try to debug using the URL directly in the address bar.
#12

[eluser]FabD[/eluser]
I have correct the problem with the variable name.
So working with the URL in the browser don't show any more error now. It simply displays as page content the URL itself
Code:
http://localhost/gerico/index.php/signal/marches/displayimage/1
#13

[eluser]TheFuzzy0ne[/eluser]
So the images themselves aren't stored in the database, you are just storing the URL?
#14

[eluser]FabD[/eluser]
I finally captured an interesting error:
Code:
<h4>A PHP Error was encountered</h4>

<p>Severity: 4096</p>
<p>Message:  Object of class OCI-Lob could not be converted to string</p>
<p>Filename: signal/marches.php</p>
<p>Line Number: 88</p>

thats the line : print($image) ;
#15

[eluser]TheFuzzy0ne[/eluser]
What do you get when you use var_dump instead of print? If you're using my model method it should be returning either '' or the value of the field if it exists.
#16

[eluser]FabD[/eluser]
Problem solved.
What was wrong : the datatype of the variable was an OCI-Lob Object.
Not allowed to put it directly into a string of course :cheese:

so here is the code of the model's method
Code:
function getImage($Id)
{
   $Q = $this->db->query("SELECT MA_PHOTO FROM GERICO.REF_MARCHES WHERE MA_ID=".$Id);
   if ($Q->num_rows())       {
           $data = $Q->row_array();
           $data = $data['MA_PHOTO'];
           $Q->free_result();  
   }    
   $size = $data->size();        
   $ret = $data->read($size);    
   return (isset($ret)) ? $ret : '';
}

Thank you, TheFuzzy0ne, for your answers, patience and tips.
#17

[eluser]TheFuzzy0ne[/eluser]
Nicely done!

Ah, I see. I'm not familiar with Oracle, I thought it would work the same as any other database. Obviously it allows you to store special objects in the database. Clever stuff...
#18

[eluser]rachj[/eluser]
Hi,

I am trying to print a long string that I have stored as a CLOB type column in ORACLE. I am trying to use the code as suggested in this thread.


$this->db->select("RESIDUES");
$this->db->from($table);
$Q = $this->db->get();

foreach($Q->result() as $field){
$s = $field->RESIDUES;
$ss = $s->size();
}

On running this, I get the following error for OCI-Lob object
Fatal error: Call to a member function size() on a non-object in (some path)/system/application/controllers/display/general_sequence.php on line 39

I would appreciate any help with this.
Thanks




Theme © iAndrew 2016 - Forum software by © MyBB