Jump to content

Recommended Posts

want to tke the output of php file and write image and save to server.

 

<?php
$file = file_get_contents('http://www.myfile.php');
$im = imagecreate(325, 160);

$bg = imagecolorallocate($im, 0, 0, 0);
$textcolor = imagecolorallocate($im, 255, 225, 255);

imagestring($im, 5, 0, 0, $file, $textcolor);  // write the string at the top left

header("Content-type: image/gif");  // output the image

imagegif($im,"new_image.gif",80);  // save the image to server
?>

Link to comment
https://forums.phpfreaks.com/topic/75309-any-errors-in-this-short-script/
Share on other sites

OK, here is what i have.  This is what I want my php output to look like: http://www.dailyscripturecards.com/daily2.php when done.

 

Instead of outputting it like the example above in which I used a table with a black background color, I want my php file above to just output the text.  Then I will take the php script with the image create and use the outputted text from daily2.php and place that inside of the black box it creates then save the whole thing to the server.

Not exaclty sure what your talking about there but this...

 

<table style="background-color:black; overflow:hidden; width:325px; height:160px; padding:0px; border:0px"><tr><td><center><b><font face="Comic Sans MS" size="3.5px" color="White" >October 29</font></b></center><font face="Times New Roman" size="2px" color="White">Let not your heart be troubled: ye believe in God, believe also in me. In my Father's house are many mansions: if it were not so, I would have told you. I go to prepare a place for you. And if I go and prepare a place for you, I will come again, and receive you unto myself; that where I am, there ye may be also.</font><center><font face="Times New Roman" size="2.5px" color="White" >John 14: 1-3</font></center></td></tr></table>

 

Is what will be retrieved by file_get_contents().

OK lets try this php file:  http://www.dailyscripturecards.com/daily.php

 

I want to take the output of that file

 

Let not your heart be troubled: ye believe in God, believe also in me. In my Father's house are many mansions: if it were not so, I would have told you. I go to prepare a place for you. And if I go and prepare a place for you, I will come again, and receive you unto myself; that where I am, there ye may be also.

John 14: 1-3 (October 29)

 

and create an image out of it and save it to the server.  Does this help?

Does this help?

 

I'm not sure. This outputs....

 

<table style="width:310px; height:155px; padding:0px; border:0px;"><tr><td><font face="Times New Roman" size="2.5px">Let not your heart be troubled: ye believe in God, believe also in me. In my Father's house are many mansions: if it were not so, I would have told you. I go to prepare a place for you. And if I go and prepare a place for you, I will come again, and receive you unto myself; that where I am, there ye may be also.</font><center><font face="Times New Roman" size="3px">John 14: 1-3 (October 29)</font></center></td></tr></table>

 

Either way, did you add the debug line I suggested? Does it throw any errors?

ow do I check for the errors

 

the line I posted earlier should be at the top of all scripts while developing.

 

should I be using file_get_contents for what I'm trying to do?

 

If you want the html source code in your image. If you don't wan't the html in there use strip_tags to remove it.

Maybe I should have explained everything differently.  What I want to do is take the result of this php file: http://www.dailyscripturecards.com/daily.php which is literally this:

 

Let not your heart be troubled: ye believe in God, believe also in me. In my Father's house are many mansions: if it were not so, I would have told you. I go to prepare a place for you. And if I go and prepare a place for you, I will come again, and receive you unto myself; that where I am, there ye may be also.

John 14: 1-3 (October 29)

 

Can you give me the code that would take that text output and put it in a box, thereby creating an image.  Then that image needs to be saved on the server. Thanks.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.