You are here: Re: Img Tag Attributes Not Being Set (Namely .width and .height) (HERE'S THE CODE... : ) ) « HTML « IT news, forums, messages
Re: Img Tag Attributes Not Being Set (Namely .width and .height) (HERE'S THE CODE... : ) )

Posted by mbstevens on 01/09/62 11:30

Nonee wrote:
> Ok, here is the code. I also included a func that tries to fix the
> window after the window is fully loaded. The func is called but it
> still doesn't work. Btw, the a = and x = is to get the image name
> from the thumbnail name... aka tnImage to Image.

> var win = window.open("", "win", winproperty); // a window
> object
> var generator = win.document;
> var root = "";
>
.................PAGE OF CODE......................
> generator.write('</html>');
>
> generator.close();
>
> }

That whole page of "generator...." code seems excessive for a pop up
enlargement of an image. Here's an example of a more reasonable
thumbnail click-through code:

<a href="images/11.jpg"
onclick="window.open('images/11.jpg','flowerwin','width=500,
height=406'); return false;">
<img src="images/1.jpg" width="50" height="41" alt="flower" />
<br />(Image opens in a new window.)<br /></a>

I'm trying to ignore the fact that pop ups are generally a bad idea
because they are inaccessible. Anyway, from the above code, you see
that you need just the images height and width to make the window pop up
the right size.

If you really _must_ have all that code from the "generator..." section,
consider a normal link to an (X)HTML page, or generate a page from a
server side program.
http://www.mbstevens.com/howtothumb/
may help.

Now, how do you get that width and height? Just as an example, you can
use the Perl module Image::Size available at cpan.org:
In a Perl script you would use:

........
use Image::Size;
.........
my ($im_w, $im_h, $im_type) = imgsize('example.jpg");
.........


....and you have them.

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация