Welcome Guest, Not a member yet? Register   Sign In
Image manipulation not working on localhost
#1

[eluser]Unknown[/eluser]
Hello guys,
I am new to CI, but I've used couple of other frameworks (Zend,CakePHP and couple of custom built ones). So far I like it - it's lighter than Zend, and faster than Cake. But I have problem with the image manipulation class. It is not working on my local machine.I use the documentation saying:

Code:
$config['image_library'] = 'gd2';
$config['source_image'] = '/upload/test.php';
$config['create_thumb'] = TRUE;
$config['maintain_ratio'] = TRUE;
$config['width'] = 75;
$config['height'] = 50;

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

$this->image_lib->resize();

if ( ! $this->image_lib->resize())
{
    echo $this->image_lib->display_errors();
}

I have GD/GD2 installed, and the whole process is going good, no errors, and I receive response "true" when I do "echo $this->image_lib->resize();", but no manipulation was done, neither a file was created. I don't know if I am missing something here ...

I tried to use $config['new_image'] = '/upload/testNEW.php'; and $config['create_thumb'] = FALSE; so I can get at least a duplicate file, but it didn't work too. I used the upload class - and it's working fine for me ...

Is there a way to trace why it is not creating the image?

Thanks.
#2

[eluser]Phil Sturgeon[/eluser]
Have you got write permissions for folders?
#3

[eluser]Unknown[/eluser]
yes, I have permission.

It is loading the class without problems and it's executing $this->image_lib->resize(); without any error - it looks like it is doing the job, but it is not ...
#4

[eluser]dsheetz[/eluser]
I'm having the same problem. Did you get any resolution to this issue?
#5

[eluser]IkoTikashi[/eluser]
Try setting the full path to the source image, i.e. /var/www/vhosts/myhost/upload/image.jpg
#6

[eluser]dsheetz[/eluser]
That's what I'm doing. I don't understand why no errors are being reported, when clearly no images are being produced. Just to make sure, here's the code I'm using:

---

$filename = "photo1.jpg";

$config['image_library'] = 'gd2';
$config['source_image'] = PHOTOS_DIR . $filename;
$config['create_thumb'] = TRUE;
$config['maintain_ratio'] = TRUE;
$config['width'] = 75;
$config['height'] = 50;

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

if (!$this->image_lib->resize())
{
echo $this->image_lib->display_errors();
}

---

Has anyone even gotten the error reporting working for this library?
#7

[eluser]IkoTikashi[/eluser]
Hm, I just tested it with CI1.7 and everything seems to be working fine, except that no errors are thrown when the folder is not writable. Setting permissions on my folder solved the problem - the thumbnail has been generated. I guess that the file IS indeed resized, but then can't be saved to the folder. You could use
Code:
$this->load->library(‘image_lib’, $config)
print_r($this->image_lib);
to dump the image_lib.
#8

[eluser]dsheetz[/eluser]
It's not a permissions problem... the dir is set to 777. Why wouldn't any errors be generated? Why bother having an error array that doesn't print?

I'm starting to think this is a server config issue. How can I determine whether or not gd/gd2/imagemagick are installed and configured properly?

From my phpinfo():

PHP Version 4.4.8
GD Support - enabled
GD Version - bundled (2.0.28 compatible)
(no mention of imagemagick)

Help! This is totally derailing my project.

Thanks,
Dan
#9

[eluser]dsheetz[/eluser]
+1
#10

[eluser]IkoTikashi[/eluser]
Can you see the image in your browser when you add the following code?
Code:
$config['dynamic_output'] = TRUE;
This should output the image and not save it to disk.

Have you tried using
Code:
$config['image_library'] = 'gd';




Theme © iAndrew 2016 - Forum software by © MyBB