Question

I'm developing an advertisement portal for a newspaper and I want to add an astonishing feature to my website.

here is my idea : I want to add a capability to let user to write his own advertisement's text withing an area then let him to tailor it as the way he/she wants it then at the end , the program calculate the inches high of his advertisement automatically for him/her.

I know how to providing the ability of tailoring a textarea in HTML/javascript but the problem is whit calculating the height of ADV in our real measurement say inches or centimeter.

is there any solution or any idea of how to doing this?

regards.

Was it helpful?

Solution

One option would be to generate an image of the text (using, say, ImageMagick) in the expected font, size, and formatting; display that image to the user for confirmation that it looks like they expect; and then measure the image. That should eliminate the issue of variation based on how it will be printed.

OTHER TIPS

I'm not 100% sure whether the ads you're talking about are going to be used online, or in the actual paper.

If you are talking about on-line ads:

Forget about inches in online advertisements. Using the term is misleading and is going to produce misunderstandings and trouble. You can't guarantee a physical fixed size on a web page. There are only Pixels - calculate with, and price by them. Explain to your customers that a Pixel can have a different size on different displays, so actual results vary.

If you are talking about paper ads created online:

@Byron Whitlock's solution suggesting PDFs would be your safest bet, because the customer can print it out and expect to see the actual result in its real size, and if not, it's down to the customer's printer settings.

That will be dependent of font and formatting. You could create a PDF form which implicitly contains width and height constraints and is easy for typesetting.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top