Click here to get back home

Re: Restricting inline image size

 HomeNewsGroups | Search | About
 comp.infosystems.www.authoring.html    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
Re: Restricting inline image size no-spam 03-29-2005
Posted by no-spam on March 29, 2005, 9:24 pm
Please log in for more thread options



Hello Jake,

My application is sort of a classified listing service. I need to be able
to let people link in their own pictures, but I want to constrain the size
that they can use (i.e. so somebody doesn't link in a huge picture that
distorts all of the listings)

I don't want to have to host their images on my server, that's why I'm not
able to resize the images myself.

It sounds like your DIV idea might work -- I'll have to give it a shot.

Thanks for the reply!




> writes
> >Hello,
> >
> >I have an HTML question that I'm not sure can be solved. I want to
> >restrict the maximum size of an inline image.
> >
> >For example, I can force the image to be 200x200 if I do this:
> ><img src=blah.gif width=200 height=200>
> >
> >But, that messes up the aspect ratio, and could size the image larger
> than
> >it's original size.
> >
> >What I want is a way to size an image such that it's aspect ratio is
> >preserved and the image is less than the given size (let's say 200x200
> for
> >now).
> >
> >I've tried placing the image in a table cell, and setting the table
cell
> >size to 200x200, but that doesn't work as the image displays in full
size
> >(stretching the table cell beyond that I specified)
> >
> >Yes, I know I can do this by manually resizing the image, or fetching
the
> >dimensions of the image and calculating a size myself. But, I am
> >specifically looking for a way to do it with an inlime image without
> >fetching it first.
> >
> >Thanks
> >
> >-----------------------------------------------------------
> >> Posted using QuadSucker/News, http://www.quadsucker.com
> >> ... the ultimate tool for newsgroup downloading!
> >-----------------------------------------------------------
>
> (a) Place the image in a containing DIV which you set to the appropriate
> width (say 200px).
>
> (b) Then set the <img> size as: width="100%'
>
> That will cause the browser to resize the image and display it as 200px
> wide.
>
> Depending on what you are trying to do, resizing the image in an image
> editor beforehand is usually the best approach.
>
> What are you trying to do?
>
> regards.
> --
> Jake
>

-----------------------------------------------------------
> Posted using QuadSucker/News, http://www.quadsucker.com
> ... the ultimate tool for newsgroup downloading!
-----------------------------------------------------------


Posted by C A Upsdell on March 29, 2005, 4:36 pm
Please log in for more thread options


no-spam@no-spam.com wrote:
> My application is sort of a classified listing service. I need to be able
> to let people link in their own pictures, but I want to constrain the size
> that they can use (i.e. so somebody doesn't link in a huge picture that
> distorts all of the listings)
>
> I don't want to have to host their images on my server, that's why I'm not
> able to resize the images myself.
>
> It sounds like your DIV idea might work -- I'll have to give it a shot.

Hmm. How about creating a box of the size you want, then specify
overflow:hidden? This should crop any oversized images, preventing the
distortion you fear.


Posted by Jon Bell on March 31, 2005, 8:10 am
Please log in for more thread options


>no-spam@no-spam.com wrote:
>> My application is sort of a classified listing service. I need to be able
>> to let people link in their own pictures, but I want to constrain the size
>> that they can use (i.e. so somebody doesn't link in a huge picture that
>> distorts all of the listings)
>
>Hmm. How about creating a box of the size you want, then specify
>overflow:hidden? This should crop any oversized images, preventing the
>distortion you fear.

And if the cropping really messes up the image, that's an incentive for
users to resize their images themselves and upload them again! :-)

--
Dept. of Physics and Computer Science Clinton, South Carolina USA


Posted by RobG on March 31, 2005, 5:22 am
Please log in for more thread options


no-spam@no-spam.com wrote:
> Hello Jake,
>
> My application is sort of a classified listing service. I need to be able
> to let people link in their own pictures, but I want to constrain the size
> that they can use (i.e. so somebody doesn't link in a huge picture that
> distorts all of the listings)

Restricting the dimensions of the displayed image will not change the
size of the image in bytes.

>
> I don't want to have to host their images on my server, that's why I'm not
> able to resize the images myself.

There are a number of automated tools for re-sampling images to
reduce their dimensions, perhaps you should investigate and use one
that is suitable for your server.

[...]


--
Rob


Posted by J. J. Cale on March 31, 2005, 10:38 am
Please log in for more thread options



> no-spam@no-spam.com wrote:
> > Hello Jake,
> >
> > My application is sort of a classified listing service. I need to be
able
> > to let people link in their own pictures, but I want to constrain the
size
> > that they can use (i.e. so somebody doesn't link in a huge picture that
> > distorts all of the listings)
>
> Restricting the dimensions of the displayed image will not change the
> size of the image in bytes.
>
> >
> > I don't want to have to host their images on my server, that's why I'm
not
> > able to resize the images myself.
>
> There are a number of automated tools for re-sampling images to
> reduce their dimensions, perhaps you should investigate and use one
> that is suitable for your server.
>
> [...]

How about a pointer. TIA
Jimbo




Similar ThreadsPosted
Restricting inline image size March 29, 2005, 6:56 pm
Re: Restricting inline image size March 30, 2005, 2:07 am
Inline-Element with higher font-size inside A: Hover about full height? November 21, 2006, 7:55 pm
fixed image size February 12, 2007, 1:53 pm
Display larger size image August 6, 2004, 11:56 pm
client-side image size changing question June 22, 2005, 6:26 am
restricting width of div October 20, 2004, 8:06 am
Firefox - Prevent TextField size change when user changes font size? October 3, 2006, 6:21 pm
Creating image maps with Adobe Illustrator or Image Ready. March 8, 2005, 12:42 pm
How to lauch an image editor when click on an image link ? November 8, 2004, 7:00 am

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap