I'm developing web application using latest codeigniter framework and SQL Server 2005. In my database, i have a table that have a column wth image datatype. From here I know how to retrieve that image with this :
$q = "Get_Picture_Test_SP @pk_rms_id=1443546";
$res = mssql_query($q);
$row = mssql_fetch_assoc($res);
$image = $row['picture'];
function hex2bin($h)
{
if (!is_string($h)) return null;
$r='';
for ($a=0; $a<strlen($h); $a+=2) { $r.=chr(hexdec($h{$a}.$h{($a+1)})); }
return $r;
}
$image = hex2bin($image);
What i want to know is how can i make a thumbnail from that image to make the web loading more fast? If I use image from some path i know how to make the thumbnail (hope i not wrong) with this :
$config['image_library'] = 'gd2';
$config['source_image'] = '/path/to/image/mypic.jpg';
$config['create_thumb'] = TRUE;
$config['maintain_ratio'] = TRUE;
$config['width'] = 75;
$config['height'] = 50;
$this->load->library('image_lib', $config);
$this->image_lib->resize();
I still dont know how to creating thumbnail from image data type. Hope anyone can help. Thanks!