p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   Classic ASP Basics (http://p2p.wrox.com/forumdisplay.php?f=61)
-   -   Preview of HTML pages (http://p2p.wrox.com/showthread.php?t=15789)

madhukp July 22nd, 2004 06:06 AM

Preview of HTML pages
Hi friends,

I have a number of HTML pages in a folder at server. I need to show a list of them in an ASP page. Then the visitor will select one from them. At that time, it should generate a thump image of the selected HTML page and show it like an image. On clicking this, it should open the HTML in its full size in a new window.

My doubt is how I can generate the thump picture of HTML page ? Can anybody please suggest some method ?

The pages and their structures are dynamic. i.e., they will change over time. Actually the pages are created by visitor with the help of an WYSIWYG tool and stored in the folder. So it is not possible to create a set of static images and use them.



rajanikrishna July 22nd, 2004 10:26 PM

hello madhu,

  I have a suggession. But i didnt check and not sure,

  read the file contents using textsreamobject and store in a variable. Generate a table dynamically with empty columns equal to the no of files u want to display. And also save the filepaths and form each column as <td name='td1' id='td1' onclick='somefunction(filename)'>&nbsp;</td> ...

Response.write strTable

This is lengthy process....

madhukp July 23rd, 2004 12:51 AM

Hello Rajanikrishna,

Thanks for the response.

But my problem is not to show a list of files. But while showing the list of HTML files, I need to show a thumb preview of the HTML page adjacent to the name of the file. I don't know how to generate the thumb preview of the HTML page.

By thumb preview, I mean the web page resized to 10% (or any other convenient) of original size. This is to help visitor choose his required template fast. (They don't like opening it in a new window.)

happygv July 24th, 2004 03:10 PM

Hi Madhu,

Unless someone could save those pages as images of required size for you, I don't think you can get there. Also I don't see any one providing components that converts html pages to thumbnail pics.

Just a thought, not sure if that could solve the purpose, you can check that out with using frames and show them on selection in a smaller size if possible.


- Vijay G
Strive for Perfection

madhukp July 26th, 2004 08:36 AM

Thanks for the responses. I agree with Vijay that there are no components (I searched for two days). So I am forced to use the following rude method.

The HTML is using only fixed pixels for widths and heights. So, I scan the HTML and replace all widths and heights in pixels by a reduced value (10% of what it is there now). This replacement was done with the help of a regular expression. Only tables, texts and images are involved. So I could do it. Then I am showing it in an inline frame. It is a ghost preview (images are all completely distorted) of what is created by the visitor.

The requirement that On clicking the reduced one, it should open the full HTML is dropped.

This is not a professional method, I agree. I hope I may be able to post a more brilliant method after some time.

happygv July 26th, 2004 03:02 PM

What do those html pages usually contain? And also remember, there should be WIDTH and HEIGHT used in every possible image,table etc... else those don't use WIDTH and HEIGHT attributes would not be reduced to a smaller value in your so called rude method;).

So how do you act upon the texts? It would be better to scan for all font tags and replace them with size attribute of value that fits your requirement.

May be you can post your code here or upload to somewhere and post the URL here, once you are done with it. Someone might suggest a better way of doing it or would fine tune it for you and for anyone who would come up with such a requirement in future.

Who knows, you can name it as Madhu's HTML Diminisher and release it soon.;)


- Vijay G
Strive for Perfection

All times are GMT -4. The time now is 10:45 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.