Welcome Guest, Not a member yet? Register   Sign In
Image Library is not saving image
#1

[eluser]Patrick Reck[/eluser]
I am trying to fetch a picture of a bear from the URL and save it as aabear.jpg. However, my code is failing. What is wrong?


Code:
$config['image_library'] = 'gd2';
$config['source_image'] = 'http://thejuxtapositionape.blog.com/files/2012/03/polar-bear-pup.jpg';
$config['create_thumb'] = TRUE;
$config['maintain_ratio'] = TRUE;
$config['width']  = 75;
$config['height'] = 50;
$config['new_image'] = 'aabear.jpg';

$this->load->library('image_lib', $config);
#2

[eluser]CroNiX[/eluser]
You're just loading the library, but not telling it to do anything. Also not sure if source_image can be a URL, the manual refers to a local path.
#3

[eluser]Patrick Reck[/eluser]
[quote author="CroNiX" date="1358461930"]You're just loading the library, but not telling it to do anything. Also not sure if source_image can be a URL, the manual refers to a local path.[/quote]

It worked using local path. Thank you
#4

[eluser]CroNiX[/eluser]
If all you are trying to do is retrieve an image from a URL and save it on your local filesystem, I'd use file_get_contents(), and then file_put_contents(). The image library is for manipulation, like cropping, resizing, rotating, watermarking, etc.




Theme © iAndrew 2016 - Forum software by © MyBB