FRIHOSTFORUMSFAQTOSBLOGSDIRECTORY
You are invited to Log in or Register a Frihost Account!

Image

 


fromegame
Hello,

Is it possible to change this page: www.frome.frih.net/image.php
into a .png image. Then I can include it in forums using

Code:
[img]www.frome.frih.net/image.png[/img]


Thanks for help! Wink

PS: Maybe fwrite?
MrBlueSky
Do something like this:

Code:

<?php
function download($file_source, $file_target) {
       $rh = fopen($file_source, 'rb');
       $wh = fopen($file_target, 'wb');
       if ($rh===false || $wh===false) {
       // error reading or opening file
           return true;
       }
       while (!feof($rh)) {
           if (fwrite($wh, fread($rh, 1024)) === FALSE) {
                   return true; // error
               }
       }
       fclose($rh);
       fclose($wh);
       return false;
   }
   
download("http://www.frome.frih.net/image.php", "/path/to/dir/picture.png")
?>
fromegame
Thanks Very Happy

But now I do have to refresh this every 5 minutes to keep the image up to date?
MrBlueSky
fromegame wrote:
Thanks Very Happy

But now I do have to refresh this every 5 minutes to keep the image up to date?


Yes, I'm afraid so
fromegame
It's a small script, isn't it? So maybe can I run it with Cron Jobs? Every minute? But I don't think it's allowed, is it?

PS: fsockopen() is suddenly disabled Shocked
MrBlueSky
fromegame wrote:
It's a small script, isn't it? So maybe can I run it with Cron Jobs? Every minute? But I don't think it's allowed, is it?

PS: fsockopen() is suddenly disabled Shocked


If you can't or don't want to use a cronjob you can add the code to save the image to the image.php script. Then you make sure this script is executed every 5 minutes or so.
fromegame
But image.php isn't opened every 5 minutes Rolling Eyes

I want to do this so I can get image.php to ping. And make an image. But now I need to open every time...?
MrBlueSky
Well, I don't no if it is permitted to use a cronjob. Maybe you should just ask, and if it is your problem is solved Smile
fromegame
Ok, well, thank you very much Very Happy
TomS
Hey. Try this out: http://www.frihost.com/forums/vp-467128.html#467128
fromegame
Hmm, could try Razz

EDIT: Yes it works.. but I prefer the other method, because it's faster to load.
MrBlueSky
I've posted another solution here: http://www.frihost.com/forums/vp-530349.html#530349

It has the advantage that you can use 1 directory for all your image-creating scripts
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2007 Frihost, forums powered by phpBB.