Welcome Guest, Not a member yet? Register   Sign In
Image resizeing
#1

[eluser]rcoder[/eluser]
How to resize image which was fatch from DB??

Code:
$image_data = $this->db->get_where('idb_products', array('i_prod_id' => $id));
$row = $image_data->row();
$image = $row->i_prod_image;
/*   IMAGE RESIZE CODE WILL COME HERE */
$image_type = $row->i_prod_image_type;
header("Content-type: $image_type");
print $image;
exit();

Please help me to write image resize code...
#2

[eluser]pistolPete[/eluser]
What are you storing in your database, just a filename or binary BLOB data?
#3

[eluser]rcoder[/eluser]
[quote author="pistolPete" date="1234500735"]What are you storing in your database, just a filename or binary BLOB data?[/quote]

As a Binary BLOB data
#4

[eluser]pistolPete[/eluser]
You have to subclass CI_Image_lib and rewrite the following functions (assuming you are using GD):
Code:
function image_process_gd($action = 'resize')
function image_create_gd($path = '', $image_type = '')

In your own image manipulation functions, you have to use imagecreatefromstring() to create an image from the database.

But I recommend storing the images as "real" files on your harddrive and insert just the filenames into the database!




Theme © iAndrew 2016 - Forum software by © MyBB