![]() |
Thumbs creation with Image Library - Problem - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Thumbs creation with Image Library - Problem (/showthread.php?tid=22377) Pages:
1
2
|
Thumbs creation with Image Library - Problem - El Forum - 09-07-2009 [eluser]Soares[/eluser] All right. So, my localhost is running under a MAC OS X. I'm using MAMP. The webserver runs under some linux distribution (I can't be sure which one). Jedd, I have no access to the original php.ini file of the server. What I was told to do (by the webserver employee) is to put my own php.ini file in my public_html folder. Well, if I put the MAMP php.ini, it will launch a bunch of errors. For this reason, I made a php.ini file containing only the settings I wanted to be modified. Which is: Code: max_execution_time = 200 There aren't two files. What the script is doing is: I upload one image and, with this one image, I create two thumbnails. As I said, if I change the order of which thumbnail (mini or big) is created, it is always the *first* that is created. Xeoncross, I'm indeed using AJAX to do this. I'm using SWFUpload, but I can't see why the problem would be related with this. The debug mode is turned on and, as you saw in the script I posted, if something goes wrong, it will echo the error. Code: if ( ! $this->image_lib->resize()) But nothing appears in the debug window. Only an 'OK'. display_errors is set to On. And the log isn't reporting any errors: Code: DEBUG - 07-09-2009 18:06:22 --> Native_session Class Initialized About the php.ini file, what do you guys think about putting the MAMP php.ini and then strip off all the lines the causes errors (which I think is a lot)? Thumbs creation with Image Library - Problem - El Forum - 09-07-2009 [eluser]Xeoncross[/eluser] Ok, that AJAX is what I thought you were using. Instead of printing out an error you should be doing something like Code: trigger_error($this->image_lib->display_errors()); So that you can see the details about the resize error (in the log) even if your browser is doing all this in the background with ajax. I don't remember with SWFUpload, but screen prints don't usually do anything in AJAX as that text is never shown to the user. Also, the log your looking at is the CI log - not the PHP log. Find the PHP error log and look at that as it will actually have useful information in it. Oh, and error reporting should be more aggressive like this so that you can spot bad coding habits before you end up with weird bugs. Code: error_reporting = E_ALL | E_NOTICE | E_STRICT Thumbs creation with Image Library - Problem - El Forum - 09-07-2009 [eluser]Soares[/eluser] Following Xeoncross directions, it ended up working. I'm not sure why, but it did. This is my original code (the one I start this post with): Code: function criarThumbs($info) After making some updates: Code: function criarThumbs($info) Basically, what I did was substituting some echos with a log function. The error part, for example, I changed echo for log_message. Now, why would it influence the behavior of the script? I really don't know. After all, the first one, with all those echos, was perfectly working in my localhost. Well.. Once done the above updates, I came back to those settings in the php.ini file. Tried with: Code: max_execution_time = 15 Code: max_execution_time = 200 None of this worked out. Than I tried this: Code: max_execution_time = 15 Making some tests, I figured that memory_limit should be as high as the images dimensions you are intending to upload. Since I'm planning to let people upload pictures of until 3000x2500, I set memory_limit to 50MB. I'm not sure if that's the correct value for this dimensions, but it worked in my tests here. I'm not sure either if these conclusions are correct, but at least it seems. Jedd and Xeoncross, thanks a lot for your help! |