PHP Classes

time out

Recommend this page to a friend!

      GIF Animation Resizer  >  All threads  >  time out  >  (Un) Subscribe thread alerts  
Subject:time out
Summary:Class blocking on some gif's
Messages:17
Author:alyn
Date:2012-03-05 13:24:14
Update:2012-07-14 09:41:28
 
  1 - 10   11 - 17  

  1. time out   Reply   Report abuse  
Picture of alyn alyn - 2012-03-05 13:24:14
It seems that it's not working on all gifs on some of them it give's time out error

Fatal error: Maximum execution time of 30 seconds exceeded in C:\Program Files (x86)\VertrigoServ\www\giff\gifresizer.php on line 423


Call Stack
# Time Memory Function Location
1 0.0029 330856 {main}( ) ..\test.php:0
2 0.0067 596416 gifresizer->resize( ) ..\test.php:5
3 0.0067 596416 gifresizer->decode( ) ..\gifresizer.php:39
4 30.0074 607360 gifresizer->get_image_block( ) ..\gifresizer.php:65
5 30.0074 607392 gifresizer->checkbyte( ) ..\gifresizer.php:294


i've got to mention that i did removed from gifresize.php

line 104 $this->transfercolortable(&$this->imageinfo["gifheader"],&$this->imagedata[$this->index-1]["imagedata"]);

the Passing by Reference sign & because i use a newer version of php.


Please give me an idea of what should i change to get it work and not to get stuck !


  2. Re: time out   Reply   Report abuse  
Picture of Taha Paksu Taha Paksu - 2012-03-11 22:27:19 - In reply to message 1 from alyn
First, what is the size of your gif file? Can you post somewhere so I can look at it?

Second, what is the max_execution_time limit in your php.ini file?

you can bypass that if you're not running on safe mode by writing ini_set("max_execution_time",60); at the top of your script.

if you're running on safe mode, you should edit your php.ini file and set a higher time limit.

  3. Re: time out   Reply   Report abuse  
Picture of alyn alyn - 2012-03-29 18:57:01 - In reply to message 2 from Taha Paksu
Hmmm ok got it .. i can't set max_execution_time because server restrictions .. i managed to do some tricks based on my script :)
anyway takin' 60 seconds to create a gif file isn't a good idea :D

default time is 30 sec on my host :) ... tnx for your support (:!

  4. Re: time out   Reply   Report abuse  
Picture of Taha Paksu Taha Paksu - 2012-04-03 20:03:15 - In reply to message 3 from alyn
ok but its still an optimization issue for me. can you send me an example file that causes the 60sec process? I'm able to convert 10 files in 5 secs in my localhost. It's a frame count related or file reading issue I think. I'm using file_get_contents and file_set_contents in my script to get file contents. maybe changing them to fopen fread would improve timings.

  5. Re: time out   Reply   Report abuse  
Picture of alyn alyn - 2012-05-08 03:32:32 - In reply to message 4 from Taha Paksu
Ok so this freaks me out , i got some gif's , everytime i try to resize it give's me error for example this one

unick.info/example/598-00236_155-fu ...

[08-May-2012 05:08:40] PHP Fatal error: Maximum execution time of 30 seconds exceeded

and also 1 more "bug" to be fixed ,recently i've been getting this

[08-May-2012 04:54:20] PHP Warning: imagecreatefromgif(animethumb/frames/frame_1336442060_05.gif)

function.imagecreatefromgif: failed to open stream: No such file or directory

it seems that sometimes "delete" proccess is executed too slow and frames (file_put_contents) are added after starting process for "creating" the gif file . (it might be a server related issue i don't know.)


  6. Re: time out   Reply   Report abuse  
Picture of Taha Paksu Taha Paksu - 2012-05-08 07:30:41 - In reply to message 5 from alyn
I've tested your file and you're right, your file has a special block order that my script can't catch and enters an infinite loop. I fixed it but there's another problem caused by PHP itself. When reading with fread(), at address 0x311 your file contains 0x32,but PHP's fread() reads 0x00. I don't know why it happens and it drives me crazy. I updated the code, please re-download the class and try it again. There'll be a distortion in the animation, but it happens because of PHP itself, not my class.

  7. Re: time out   Reply   Report abuse  
Picture of Taha Paksu Taha Paksu - 2012-05-08 08:16:16 - In reply to message 5 from alyn
Ok I fixed it. You can redownload and test.

  8. Re: time out   Reply   Report abuse  
Picture of alyn alyn - 2012-05-08 20:45:58 - In reply to message 7 from Taha Paksu
ok i try it though' it works , but (always is a but lol) after 3 - 6 repeatead refresh on the page (1 to 2 sec interval ) i get this


fopen(animethumb/frames/frame_1336505315_00.gif)
function.fopen: failed to open stream: No such file or directory
fseek() expects parameter 1 to be resource, boolean given

and here on this one http://gowap.ro/portal/download/308

i get this err:

function.imagecreatefromgif:

'animethumb/frames/frame_1336505737_00.gif' is not a valid GIF file

its decompiling in a "uknown" string ...or something //

{{{ private function resizeframes(){
$k=0;
foreach($this->parsedfiles as $img){
$src = imagecreatefromgif($img); }}}

i think is frighten by that wolf :)) in the pic.


and also this one http://gowap.ro/portal/download/307 is returning


substr() expects parameter 1 to be string, array given


gifresizer.php on line


private function transfercolortable($src,&$dst){
....................

else{
-------------------------------
//inject color table
$dst = substr($dst,0,10).$ghgct.substr($dst,-1*strlen($dst)+10);
}

....................



and manny more .. i dont know if those errors are returning because of my host (it might be) .. try them and reply i'm curious .

  9. Re: time out   Reply   Report abuse  
Picture of Taha Paksu Taha Paksu - 2012-05-08 23:35:08 - In reply to message 8 from alyn
Ok, I don't know the reason of the 2nd bug, but I solved the first one. Try and tell me again.

  10. Re: time out   Reply   Report abuse  
Picture of alyn alyn - 2012-05-09 00:40:20 - In reply to message 9 from Taha Paksu
yup great work :D


but still remains

failed to open stream: on fopen(..); & imagecreatefromgif ;

anyway i think is from my server because this error is returning since 3 days ago .. :)

and something else i've got to ask , it is possible to code it without using passing by refference sign "&" ? and update it to the new php 5 standards .

 
  1 - 10   11 - 17