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

[eluser]Bram Jetten[/eluser]
I am creating a WYSIWYG-editor ( http://cl.ly/e24d621d45dd6dacb9a7 ). It also has image uploading capability. When uploading small to moderately sized images they are uploaded, resized and copied. However, when I try to upload a really big picture (say 6 MP JPG) it will successfully upload that entire image, but just won't do any of the image manipulations. Does this sound familiar?

Here's the code I'm working with:

Code:
if(!$this->upload->do_upload()) {
            echo "Mislukt";
        } else {            
            $imgdata = $this->upload->data();
            $afbeelding = $imgdata['file_name'];
            
            $upload_config['source_image'] = $imgdata['full_path'];
            $upload_config['width'] = 550;
            $upload_config['height'] = 550;
            
            $this->image_lib->initialize($upload_config);
            $this->image_lib->resize();
            
            $upload_config['create_thumb'] = true;
            $upload_config['thumb_marker'] = "_thumb";
            $upload_config['width'] = 100;
            $upload_config['height'] = 100;
            $this->image_lib->initialize($upload_config);
            $this->image_lib->resize();
            
            echo base_url() . "uploads/fotos/" . $afbeelding;
        }
#2

[eluser]cahva[/eluser]
Sounds like memory limit issue.. or you've hit the max execution time. For example resizing ~1M jpeg can easily consume 32M of memory as the processing is done with the raw picture inmemory. So you can imagine how much memory it will need to process 6 meg pic.

If you can, try ImageMagick in the config(and if its installed). Atleast with that it wont use the memory_limit set in PHP.
#3

[eluser]Bram Jetten[/eluser]
@cahva
Thanks for the tip! After checking out the error logs I found several entries of the following message:

Code:
[Wed Nov 03 21:47:21 2010] [error] [client 77.250.86.248] PHP Fatal error:  Allowed memory size of 33554432 bytes exhausted (tried to allocate 11672 bytes) in /var/www/vhosts/bsdewaai.nl/httpdocs/system/libraries/Image_lib.php on line 1157, referer: http://www.bsdewaai.nl/blog/dashboard

I do not have access to ImageMagick on this particular server. Is it OK to adjust the memory_limit to a higher value so that it won't get exhausted again? Or should I look for a different solution?
#4

[eluser]Christophe28[/eluser]
When you get the following error ...

"Allowed memory size of 33554432 bytes exhausted"

... there are two things you can do:

1) Increase the memory_limit in your php.ini file to 64MB (or more if necessary) and restart apache. Let us hope it is not 'mislukt';
2) Define the memory limit in your .htaccess (check the internet about how to do this)

You don't have to change anything in ImageMagick ;-)

Can you notify me if you have a beta version of your wysiwyg editor? I need something like that! (or isn't it open source?) I just need to be able to write in bold and be able to set some big smilies.

Christophe
#5

[eluser]Bram Jetten[/eluser]
Thanks for your help guys. My problem is solved! I ended up setting the memory limit in .htaccess to 64MB.

@Christophe28:

I'm using the following source: http://www.wymeditor.org/. I'm just creating a nicer skin and adding proper image uploading/resizing.




Theme © iAndrew 2016 - Forum software by © MyBB