Jump to content

Turning HTML into a picture


HaLo2FrEeEk

Recommended Posts

Ok, let's try this again.  I have a tutorial section on my site, it has the full template of the rest of my site and is powered by my database.  I want people to have a url for each tutorial that they can use to embed an image of just the tutorial text (and the imges in the tut too.)  For example, let's say I wanted to turn this tut into a picture, only the text from "This tutorial was written by..." to before it says "Questions?  Ask them..." would be on the picture.  Is this possible?  To put HTML onto a picture, and if so how would I go about doing it.

 

PS. the reason I'm doing this is becuase some sites don't like that I "force" them to my site to view the tut, this way the tut is embedable on a website or forum so the people don't have to go to my site, but my site will still be advertised.

Link to comment
Share on other sites

you can use the gd library build in php to create your own custom "picture" of whatever tutorial you want

 

you can write text on images, other images..etc....

You can create an algorithim to do this automatically and uniformly for tuts...

 

You can grab the information from a mysql db maybe...

The picture can even be dynamic as well, as information from the db may change, it may write different things on the picture..etc...

Link to comment
Share on other sites

That's what I want, and I had some experience creating this:

 

HaLo2FrEeEk.png

 

Those are live stats from my forum, taken from the database everytime this picture is requested.  What I do not know how to do it make the HTML actually show up right, and not as the actual tags.  You know what I mean?

Link to comment
Share on other sites

You can't make the html render in an image. :)

 

HTML is code that is only rendered in browsers like IE, firefox..etc...

 

You say html bla bla bla... What do you really mean, the neat little text, images, and format of them all on your particular page? I think you do :)

 

You can "fake" html rendering in your image, and dress up the text, images, and other info you want to display in the pic any way you want, make a template background image and make an algorithim to format wordwrap, all these thigns you can do to make your image look like a picture of a rendered html page...etc....

 

No its not truly html being rendered in an image, but it will sure look like it :)

Link to comment
Share on other sites

Dude, I'm not stupid, if you'd actually read the above posts, you'd realize that I know how to create images using the GD library and PHP, since I posted something I'd made using that up above, and here is some of the code I wrote for that project:

 

<?php
$user = $_REQUEST['user'];
include('./getstats.php');
header("Content-type: image/png");
$im = imagecreatefrompng($_SERVER['DOCUMENT_ROOT']."/forum/stats/statsig.png");
if($avitype == "gif") {
  $avatarim = imagecreatefromgif($avatar);
  } else if($avitype == "jpg") {
  $avatarim = imagecreatefromjpeg($avatar);
  } else {
  $avatarim = imagecreatefrompng($avatar);
  }
// Center username
$box_user = imagettfbbox(14, 0, './bonzai.ttf', $user);
$userwidth = $box_user[4] - $box_user[6];
$userheight = $box_user[1] - $box_user[7];
$user_w_diff = (130 - $userwidth);
$user_h_diff = ((25 - $userheight) / 2);
$user_x = ($coords_x[0] + $user_w_diff);
$user_y = ($coords_y[0] - $user_h_diff);
// End center username

//...(more code to format the locations of the various informations)

imageSaveAlpha($im, true);
$white = imagecolorallocate($im, 255, 255, 255);
imagefttext($im, 14, 0, $user_x, $user_y, $white, './bonzai.ttf', $user); // Username
imagefttext($im, 14, 0, $joindate_x, $joindate_y, $white, './bonzai.ttf', $joindate); // Joined
imagefttext($im, 14, 0, $postcount_x, $postcount_y, $white, './bonzai.ttf', $postcount); // Post Count
imagefttext($im, 14, 0, $style_x, $style_y, $white, './bonzai.ttf', $style); // Board Style
imagefttext($im, 14, 0, $lastvisit_x, $lastvisit_y, $white, './bonzai.ttf', $lastvisit); // Last Visit
imagecopymerge($im, $avatarim, $avi_x, $avi_y, 0, 0, $aviwidth, $aviheight, 100); // Avatar
imagepng($im);
imagedestroy($im);
?>

 

Obviously I know what I'm doing, I just need to know, how do I put bold, italicized, and colored text, shaded div boxes, lists, and other things into one picture.  Look at my tutorials and see how they are formatted, and you will understand a little better.

Link to comment
Share on other sites

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.