I need to upload to accept image upload on my site. I also need to display
these images in a databound control.
The image are upload in a database.
My concers are:
-How do i enforce size limit on image?(which size is acceptable?)
I'm thinking of using a custum validator and validate the image for a
certain size.
Any comment will be higly appreciated.
Many thanks in advanceWhen you say "size", do you mean the width and height, or the phsyical file
size?
"Jensen bredal" <jensen.bredal@.mimosa.com> wrote in message
news:el%23GF06SEHA.3580@.TK2MSFTNGP09.phx.gbl...
> Hello gurus
> I need to upload to accept image upload on my site. I also need to
display
> these images in a databound control.
> The image are upload in a database.
> My concers are:
> -How do i enforce size limit on image?(which size is acceptable?)
> I'm thinking of using a custum validator and validate the image for a
> certain size.
> Any comment will be higly appreciated.
>
> Many thanks in advance
>
Well that were i'm very
. I thought there wasa linear relation between the two parameter you mentioned.
But my knowledge is really weak in this area.
Assume the size is 3000000 bytes and the type is"filetype /JPEG". Does this
relate
to a unique (width , heigt) pair?
I assume a 50 k maximum size should be allowable.
What does it correspong to in terme of size(bytes)?
Does this depend on weather "JPEG" or "GIF"?
"Peter Rilling" <peter@.nospam.rilling.net> wrote in message
news:%23koRi46SEHA.1508@.TK2MSFTNGP11.phx.gbl...
> When you say "size", do you mean the width and height, or the phsyical
file
> size?
> "Jensen bredal" <jensen.bredal@.mimosa.com> wrote in message
> news:el%23GF06SEHA.3580@.TK2MSFTNGP09.phx.gbl...
> display
>
I don't know much about image processing and formats, but the physical file
size has no relationship to the width/height of am image. Image formats
contain extra information such as color indexes or extra metadata that adds
additional information. In addition, most web formats allow for loosy
compress which mean that some information is lost. Different files can have
different compression thresholds.
If you wanted to limit the upload size (in bytes) there is a size limit that
you can impose on ASP.NET so that huge files are not uploaded. This is
something that can be set in the web.config or machine.config. If you want
to limit the width/height of an image, you will need to look at the contents
of the file. If you know the format, the less processor intensive method
might be to open the uploaded file in a stream and locate the appropriate
bytes that identify this information. If you do not know the format well,
you can always load the stream into an Image object and use the
methods/properties available.
"Jensen bredal" <jensen.bredal@.mimosa.com> wrote in message
news:uDtyHn7SEHA.2692@.TK2MSFTNGP09.phx.gbl...
> Well that were i'm very
. I thought there was> a linear relation between the two parameter you mentioned.
> But my knowledge is really weak in this area.
> Assume the size is 3000000 bytes and the type is"filetype /JPEG". Does
this
> relate
> to a unique (width , heigt) pair?
> I assume a 50 k maximum size should be allowable.
> What does it correspong to in terme of size(bytes)?
> Does this depend on weather "JPEG" or "GIF"?
>
>
>
> "Peter Rilling" <peter@.nospam.rilling.net> wrote in message
> news:%23koRi46SEHA.1508@.TK2MSFTNGP11.phx.gbl...
> file
>
Well that was great help.
Thank you...
"Peter Rilling" <peter@.nospam.rilling.net> wrote in message
news:Ojawh1$SEHA.2944@.tk2msftngp13.phx.gbl...
> I don't know much about image processing and formats, but the physical
file
> size has no relationship to the width/height of am image. Image formats
> contain extra information such as color indexes or extra metadata that
adds
> additional information. In addition, most web formats allow for loosy
> compress which mean that some information is lost. Different files can
have
> different compression thresholds.
> If you wanted to limit the upload size (in bytes) there is a size limit
that
> you can impose on ASP.NET so that huge files are not uploaded. This is
> something that can be set in the web.config or machine.config. If you
want
> to limit the width/height of an image, you will need to look at the
contents
> of the file. If you know the format, the less processor intensive method
> might be to open the uploaded file in a stream and locate the appropriate
> bytes that identify this information. If you do not know the format well,
> you can always load the stream into an Image object and use the
> methods/properties available.
> "Jensen bredal" <jensen.bredal@.mimosa.com> wrote in message
> news:uDtyHn7SEHA.2692@.TK2MSFTNGP09.phx.gbl...
> this
a
>
Checkout this C# Code. Easy to convert to VB if requied.
http://www.aspheute.com/english/20001130.asp
If you need to resize the image then follow this.
There is a Ratio for each image. Suppose they are 800 X 600 then you divide
800 by 600 to get a ratio of 1.3. The only difference is first check which o
f this is greater & always divide the greater by the smaller value. If you f
ind that the height is grea
ter then reduce the height maybe say 100 px and then reducde the width by th
is Ratio.
This tip is because you are trying to povide a list to the user. Thumbnails
should be easier for your Server to handle.
Regards,
Trevor Benedict R
MCSD
Well those pieces of code really rock.
That was a major help i must admit...
Thank you to you all.
"Trevor Benedict R" <trevornews@.yahoo.com> wrote in message
news:A663FFE7-881E-44F9-8589-DF8ABB957664@.microsoft.com...
> Checkout this C# Code. Easy to convert to VB if requied.
> http://www.aspheute.com/english/20001130.asp
> If you need to resize the image then follow this.
> There is a Ratio for each image. Suppose they are 800 X 600 then you
divide 800 by 600 to get a ratio of 1.3. The only difference is first check
which of this is greater & always divide the greater by the smaller value.
If you find that the height is greater then reduce the height maybe say 100
px and then reducde the width by this Ratio.
> This tip is because you are trying to povide a list to the user.
Thumbnails should be easier for your Server to handle.
> Regards,
> Trevor Benedict R
> MCSD
0 comments:
Post a Comment