Welcome Guest, Not a member yet? Register   Sign In
image_lib problems
#1

[eluser]evilgeoff[/eluser]
I'm sure some of this if my fault but I've had nothing but problems with CI so far. I love the idea of the framework and the ease of installation but it seems like it's one thing after another. Again a lot of this could be what this does based on my needs and they don't jive but I'm still a little frustrated.

Currently the image_lib doesn't work.

I've tried everything I've found on this site.

I get this error: <p>Your server does not support the GD function required to process this type of image.</p><p>Your server does not support the GD function required to process this type of image.</p>

I've installed gd it shows up in phpinfo().
I've checked the permissions of the image folder that's fine.
I checked to make it was installed at all.

I've set it to initialize the library's $config.
$config['image_library'] = 'GD2';
$config['source_image'] = $path;
$config['create_thumb'] = TRUE;
$config['maintain_ratio'] = TRUE;
$config['width'] = 80;
$config['height'] = 80;
$config['new_image'] = $path.'/new/'.$image.'.jpg';
$this->load->library('image_lib');
$this->image_lib->initialize($config);
$this->image_lib->resize();
if ( ! $this->image_lib->resize())
{
$this->firephp->log($this->image_lib->display_errors());
}
$this->image_lib->clear();

I've tried everything and still nothing. At this point I would just drop this framework and move as I have deadlines, but I'm too far into the project to turn around. I'm sure this is my fault somehow but I just need results at this point before I get fired. Serious about the last part.
#2

[eluser]xzela[/eluser]
this may be a silly question but.... have you tried rebooting it?

I know when I was first playing around with apache/php/mysql I would always forget to restart the apache server.

Are there any other error messages? Also, check your log files.
#3

[eluser]evilgeoff[/eluser]
That's not dumb at all. Always a good thing to try. I'll take a look at the logfile. Thanks.

One more thing to mention if this matters. I'm on lighttpd.
#4

[eluser]dmorin[/eluser]
What is the format of the image you're using? Make sure it's a gif, jpg, or png. Have you tried multiple images or just the same one?

I'm not the biggest fan of CI's image library. I've used http://wideimage.sourceforge.net/wiki/MainPage before. It might be worth trying it also to see if you get different results.
#5

[eluser]evilgeoff[/eluser]
Just a jpg. I was doing them in a loop but I've since set it up to do just one file and same results.

I'll try that out.

I am not getting the gd error as often now I'm getting a read/write error but everything is writeable and readable.

I'll look into wideimage. I wonder how hard it would be to add to CI. If I had time I'd try, maybe this weekend I'll give it a shot and post my results if I have time.
#6

[eluser]humugus[/eluser]
maybe ..
is your PHP safe mode ON or off ??
#7

[eluser]Derek Allard[/eluser]
One thing you could do is take CodeIgniter out of the equation and try running the function directly and see what you get.
#8

[eluser]evilgeoff[/eluser]
I would love to say that something you guys said helped or that I figured this out or anything like that but literally it worked all of the sudden. I really do appreciate your help and I'll start to use this forum more often instead of getting frustrated by weird behavior.

I do know that it will not work at all unless I use this $this->image_lib->initialize($config); that is the only thing I've found that HAS to be there for this to function now. I literally don't know why this started working. Again thank you all though.
#9

[eluser]dirkpostma[/eluser]
I use CI 1.7.2, develop on a Mac Leopard using MAMP. After a few hours struggeling, I discovered that the library's config setting "new_image" is not working as expected.

I used this code:
Code:
$config['image_library'] = 'gd2';
    $config['source_image'] = "/myexamplepath/imagetoresize.jpg";
    $config['new_image'] = "/myexamplepath/resized_image_tyuiobv"; // some new unique filename
    $config['create_thumb'] = FALSE;
    $config['maintain_ratio'] = TRUE;
    $config['width'] = $max_width;
    $config['height'] = $max_height;

In that case, when you call image_lib->resize(), it tries to write to:

/myexamplepath/resized_image_tyuiobv/imagetoresize.jpg

So, the original filename is concatenated to the new filename! Very strange behaviour in my opinion! Do other users have the same problem?
#10

[eluser]Unknown[/eluser]
It doesnt concat, it makes it a folder because there is no filename extension on the 'new_image' string. Add .jpg to the end of that and I bet it doesn't concat the strings.




Theme © iAndrew 2016 - Forum software by © MyBB