I need to convert HTML into image so that no one should be able to copy it. The code should be in php without any javascript used for conversion. A simple code is appreciated however, if you know a class for it then also inform me.
Do you mean just like web thumbnail? if so, check this out www.zubrag.com/scripts/website-thumbnail-generator.php
I need to convert a text with plain html into an image. Not the complete webpage. I need the php code.
what do you mean? render the HTML? just display the text on the site as image? in that case, look into gd
I mean a formatted <div> with <b> <table> etc. in the html to be converted to image. Rest of the area will remain text for search engines to find. I just want to protect the main information from being copied.
You can't replace tables without images without also making the text an image. This is impossible, and you are being paranoid
You (almost) all got him wrong.. salahsoftware, as someone said, this can be done with GD. I'm just wondering is it worth it. Think about it.. if I wanna steal your content (not that I do that kind of stuff anyways..), converting the text to an image will delay me, but can never stop me! Think about is what you're trying to do worth the effort of doing it
hi xlcho, I am creating a skill testing site. I want to convert the test questions into image so that the user cannot copy and paste the question in google to find out the answer. If the user type the question in google, it will take time, therefore the total time for answering question will expire. Hence, the logic is to ensure that the user does not cheat the test system by copy-pasting the question to find out answer. Thanks in advance
I know how to convert plain text to an image. I have created captcha earlier, however the point is to convert the html code into image so that the text looks formatted.
Yea, that can be done easily: <?php header ('Content-type: image/png'); $im = @imagecreatetruecolor(120, 20) or die('Cannot Initialize new GD image stream'); $text_color = imagecolorallocate($im, 233, 14, 91); imagestring($im, 1, 5, 5, 'A Simple Text String', $text_color); imagepng($im); imagedestroy($im); ?> PHP: This will output an image with the words 'A Simple Text String' on it. This is kind of a bad way to do it though. . . Why not just use css and stretch an opaque image across the question? I've seen that done before and it will stop most people from copying and pasting. . .
I think it is no need to do that, Although you can converted the page to image use code, The one can't copy on your web, but the page can be saved to pc, Open it on Dreanware or other editor, Then they can copy your HTML easily.
Example based on GD is alredy provided. And advanced example for colors and custom ttf font may be consulted in the code of DPI 1.1, in upload.php, I created here. Example: <? $text = " <html> <head> <title>some title</title> </head> <body> Here goes content </body> </html>"; $padding = 10; #10px $fsize = 12; #font size 12 pixels $ttf ="./Tahoma.ttf"; #path to windows ttf font file $size = imagettfbbox($fsize, 0, $ttf, $text); $xsize = abs($size[0]) + abs($size[2])+($padding*2); $ysize = abs($size[5]) + abs($size[1])+($padding*2); $image = imagecreate($xsize, $ysize); $white = imagecolorallocate ($image, 255, 255, 255); $black = imagecolorallocate ($image, 0, 0, 0); imagefilledrectangle ($image, 0, 0, $xsize, $ysize, $white); imagettftext($image, $fsize, 0, $padding, $fsize+$padding, $black, $ttf, $text); #save to file imagejpeg($image,"./screenshot.jpg",85); #85%quality ?> PHP: I hope it helps. regards
is there any html rendering engine available in gd in which we can just pass the html and it will render the output as displayed on browser?
the problem is that you need a browser to render it, then a program to create a virtual screen for that browser to work on, then a program to make a screencapture of that. gd != html rendering engine, gd == graphics engine. the first reply in this post seems a valid solution for what you want to do, but you'd have to install a windows server somewhere that can do it for you.
good thread on the subject; http://www.webhostingtalk.com/showthread.php?t=698752 http://browsershots.org/ http://www.browsercam.com/Default2.aspx http://trac.browsershots.org/