Jump to content

File Appears Long After Script has Completed?


jebego

Recommended Posts

So, I have a very long script that I really don't think is relevant, here's the last part that actually creates this belated-file:

$image_name = microtime() . ".jpeg";
$handle = fopen("mosaics/" . $image_name,"x+");
imagejpeg($final_image, "mosaics/" . $image_name);

Basically, this creates an image out of the variable $final_image in the directory mosaics/ with a timestamped name.

 

The final image size is ~10.8 mb.

 

So, what happens...

1. I run the php script

2. The script finishes

3. I refresh the mosaics/ directory in my ftp client, but the file isn't there

4. After a few minutes, the file appears

 

I have no idea why this is happening!

 

Thanks for the help!

Thanks again for the reply!

 

I added the imagedestroy($final_image); line to my code. It didn't fix my problem, but I should have had it there anyways, as not using it can apparently cause memory problems.

 

Any other ideas?

write a loop that sleeps http://ca2.php.net/sleep for a few seconds and loops until file exists http://ca2.php.net/manual/en/function.file-exists.php and prints out how many times it looped. Or something.

 

Maybe the jpeg creation function just takes that long. :-/

Yes! I looked up what you said, and ended up creating a loading bar. This send data to the browser which kept it from timing out.

 

In the end, apparently the creating of the image takes ~10 minutes. I'll be looking for a way to make that smaller later. Thanks a ton!

Yes! I looked up what you said, and ended up creating a loading bar. This send data to the browser which kept it from timing out.

 

In the end, apparently the creating of the image takes ~10 minutes. I'll be looking for a way to make that smaller later. Thanks a ton!

 

Great. What does your nickname stand for? PM if you don't want EVERYONE to know :)

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.