PHP Developers Network

A community of PHP developers offering assistance, advice, discussion, and friendship.
 
Loading
It is currently Sun May 20, 2018 2:29 pm

All times are UTC - 5 hours




Post new topic Reply to topic  [ 1 post ] 
Author Message
PostPosted: Sun May 17, 2009 10:43 am 
Offline
Forum Newbie

Joined: Sun May 17, 2009 10:24 am
Posts: 1
Hello, I am new to php and strugling with a minor annoyance.

I have a scrip that grabs a image from a remote server (webcam) and feeds it to the visitor browser, with DHTML the script is called every 5 seconds and the image is being updated. The image on the remote server itself is being updated every 6 seconds or so.

Everything works fine, but:

I dont have control over when the image on the remote server is being updated so, every once in a while I grab the image on the remote server while the image on the remote server is being updated, so just a partial image is created.
This is the php code that does it (crude, but it works):
Syntax: [ Download ] [ Hide ]
 
<?
$img_dir = "http://address_of_the_remote_server/";
$original = imagecreatefromjpeg($img_dir."imagename.jpg");
 
if ($original){
$headers = "Content-type: image/jpeg";
header($headers);
imagejpeg($original);
imagedestroy($original);
}
?>
 

So, I want to check the size (actual filesize, not HxW), I know that if the filesize is less that 10K the imagecreate has failed to get the whole image, but I have no way to check what real filesize the resource $original has.

- Does anyone knows a way to check the memory usage or the size (in file or memory terms) of a GD resource ?

Any other pointer to do correctly what I intend to do will be appreciated.

Thanks for your help.

Salva


Last edited by Benjamin on Sun May 17, 2009 11:02 am, edited 1 time in total.
Added [code=php] tags.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group