Identify file size of remote image on a image, without having to copy file to local file system

Hi

I am builing some admin tools for a client and I am trying to identify the file size of an image via its URL (eg.  http://www.remotedomain.com/image.gif)

 Is there a way of doing this without copying the image to the local file system and then manipulating the file locally to get its file size

Many thanks inadvance

0
BigMeat
10/2/2007 8:35:13 PM
asp.net.web-forms 93655 articles. 6 followers. Follow

3 Replies
1396 Views

Similar Articles

[PageSpeed] 5
Get it on Google Play
Get it on Apple App Store

Using a HttpWebRequest object, could you send a HEAD request and then use the ContentLength property of the corresponding WebResponse

0
squaret
10/2/2007 9:25:35 PM

Thanks worked a treat, I used the following

 Dim url As String = http://www.domain.com/image.gif

Dim obj_HTTPWebRequest As System.Net.HttpWebRequest = CType(System.Net.HttpWebRequest.Create(url), HttpWebRequest)

Dim obj_HTTPWebResponse As System.Net.HttpWebResponse = CType(obj_HTTPWebRequest.GetResponse(), HttpWebResponse)

Response.Write("Size = " & obj_HTTPWebResponse.ContentLength)

 Many thanks

0
BigMeat
10/3/2007 9:41:11 AM

 Hello

I know the target was the file size, but I found this topic when I was looking for some way to discover the file height and width. So I am writing the code bellow just to help someone else with the same problem I had. 

        Dim url As String = "http://www.runnerbrasil.com.br/images/Forum.jpg"

Dim ImageStream As System.IO.Stream = New System.Net.WebClient().OpenRead(url)
Dim limgAux As System.Drawing.Image = System.Drawing.Image.FromStream(ImageStream)

Label1.Text &= "Height = " & limgAux.Height & "<br />" & _
"Width = " & limgAux.Width & "<br />"

 tks

Fabio

PS: this code was inspired by http://blogs.msdn.com/danielfe/archive/2004/07/26/197811.aspx

0
fabio
4/20/2009 5:21:04 PM
Reply:

Similar Artilces:

superreview requested: [Bug 334341] Using image tags with a non image file, and selected view image, file will still load up, allowing access to system resources : [Attachment 219194] Possible fix
Boris Zbarsky <bzbarsky@mit.edu> has asked Daniel Veditz <dveditz@cruzio.com> for superreview: Bug 334341: Using image tags with a non image file, and selected view image, file will still load up, allowing access to system resources https://bugzilla.mozilla.org/show_bug.cgi?id=334341 Attachment 219194: Possible fix https://bugzilla.mozilla.org/attachment.cgi?id=219194&action=edit ------- Additional Comments from Boris Zbarsky <bzbarsky@mit.edu> I'm not so happy with this in general, but until we start using URIs end to end, this is the best we can do. :(...

superreview granted: [Bug 334341] [FIX]Using image tags with a non image file, and selected view image, file will still load up, allowing access to system resources : [Attachment 219194] Possible fix
Daniel Veditz <dveditz@cruzio.com> has granted Boris Zbarsky <bzbarsky@mit.edu>'s request for superreview: Bug 334341: [FIX]Using image tags with a non image file, and selected view image, file will still load up, allowing access to system resources https://bugzilla.mozilla.org/show_bug.cgi?id=334341 Attachment 219194: Possible fix https://bugzilla.mozilla.org/attachment.cgi?id=219194&action=edit ------- Additional Comments from Daniel Veditz <dveditz@cruzio.com> This is pretty ugly having to test all the different fixups. sr=dveditz, OK for the 1.8 bra...

How to insert a image (from a image file) into the existing tif file?
How to insert a image into the existing tif file? Look here (download the source code):http://www.codeproject.com/KB/GDI-plus/SaveMultipageTiff.aspx And here: http://www.codeproject.com/KB/vb/multipagetiff.aspx Please click "Mark as Answer" if you think this post answers your question...

File.Copy and File.CopyTo DO NOT COPY CONTENTS OF FILE!@
I posted on here before but no one has been of any help. I am trying to copy files of type .zip .jpg and .pdf from ones folder to another (I dont want to move it, just make a copy). How can I do this? When I use File.Copy and File.CopyTo it makes a new file in the right folder but has no content and it also erases the content on the orignal file. WTF? This is really making me mad. Visit VistaForums.com #1 Windows Vista Forum Here you go --->  http://www.aspfaqs.com/aspfaqs/ShowFAQ.asp?FAQID=207Regards, Narayana Rao Surapaneni Architect | Author | MCSD for .NET | MCSD | SCJP ww...

How to convert .tiff image file to .pdf file without using any 3rd party tool using C#.net
HI allI have a urgent requirement i want to convert .tiff image to .pdf file Thanks in advance Regards RaviPlease click "mark as answer" if this post helped you. I dont think its possible without doing a lot of code or using third party tools, but if you  are looking for a free tool you can try a combination of http://blog.codebeach.com/2008/02/convert-multipage-tiff-to-pdf-in-net.htmland  http://www.codeproject.com/KB/aspnet/Creating_PDF_documents_in.aspx Thanks and RegardsS.K.Vignesh----------------------Do remember to "Mark as answer" for this pos...

Image files in xml files
Hi! Does anyone know how to transport image files with xml files. A colleague of mine writes an xml file containing an image. This has been coded using the sun.misc.BASE64Decode. Is there any way I can decode this using Powerbuilder 8? To read the xml file I'm using Microsofts xml parser. Jan Erik The following link is a command-line base64 encoder/decoder -- http://www.fourmilab.ch/webtools/base64/. -- <hopethishelps/> Roy Kiesler [TeamSybase] Sybase Developer Network (SDN) -- http://sdn.sybase.com "Jan Erik Hermansen" <jeh@susoft.no>...

COnverting image file into PDF file in C#.NET
hi friends, i have a problem in creating a PDF file from an image file. first of all pls clarify what is the internal concept in converting to PDF file. if nay one knows pls mail me the related code if you find any solution pls mail me at spend5mins@yahoo.com thank u all hari babu...

to file:// or not to file://
(Firefox 1.5.0.6) I'm having trouble with HTML Anchors (links) using the file: protocol. The URL I'm trying to get at looks something like this file://///Host.Domain/Share/Dir1/Dir2/File.Ext If I click on the link, /nothing/ happens but, if I "Copy Link Location" and paste exactly the same thing into the "address bar" in FireFox, FireFox is perfectly happy to show me the file. Why the difference? Am I tripping over some security restriction here? Any suggestions? TIA, Phill W. Phill W. wrote: > (Firefox 1.5.0.6) > I'm ...

When right clicking on an image file and using "save image as" it does not save the file
Name: Beavis Product: Firefox Summary: When right clicking on an image file and using "save image as" it does not save the file Comments: When right clicking on an image file and using "save image as" it does not save the file. If you uninstall firefox and re-instal it, then it will work until you re-boot or shut down. After a startup it again will not save an image as using the "save image as" right click function Browser Details: Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.8.1) Gecko/20061010 Firefox/2.0 ...

copying a file without using module File::Copy
Hello All, Is the only way to copy a file from one directory to another by using the copy module...? Would anyone have a snipet of code copying a file from one dir to another... Any assistance would be appreciated... Thank you, Mike ------------------------------------------------ On Fri, 14 Feb 2003 10:13:06 -0500, Michael Pastore <Michael.Pastore@frontstep.com> wrote: > > Hello All, > > Is the only way to copy a file from one directory to another by using the > copy module...? > > Would anyone have a snipet of code copying a f...

file to file copy
--nextPart3236501.eDU2PhZZ46 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8Bit hello, i have to write a perl script which copies text from one file to another but only if the text is not exisiting yet. For example: in file1: word: moon word2: sky .... the same syntax for every line in file2: #some text word: honey word3: lol word4: mu .... as well the same syntax for every line so now i want to merge file1 into file2, so that word: honey will be replaced by word: moon and word2: sky will be appended to file2. i have written the following...

append local file to remote file
Apologies for the loosely interpreted perl issue below. I have rsh on my system and nothing else is available that I know of. I need to send a local file to a remote system and APPEND the local file to the remote file. All I can find in the man pages however is how to do just the reverse. I realize that I can rcp it over then do the remote file append to remote file, but I'd like to do the whole process in ONE step not two. Any ideas? Anything in Perl? _________________________________________________________________ Get your FREE download of MSN Explorer at http://ex...

get file size from web file
Hello, I'm writing a vb.net application that is getting files from the internet. How can I get the filesize from a file (could also be an html or aspx page) that is located on the web? The system.io only works for diskfiles. Kindest regards, Tom Govaert Hello, I passed through this before, you need to tranform the url into a physical address. Ask you hosting company on the disk drive that is used to access your files locally and then use it to do the conversion. regards.Bilal Hadiar, MCP, MCTS, MCPD, MCTMicrosoft MVP - Telerik MVP...

image files storage -- remote from image server?
zen 7 sp1(x) We have an image storage location which is defined on a different server (ie it is NOT the imaging server). Is this a supported configuration? Apparently it is NOT working, and the workstation tech has to copy images from the intended storage to the (much smaller) volume that is local to the imaging server. Peter All you have to do is install the imaging piece on the secondary server. -- Timothy Leerhoff Novell Support Forum Sysop Timothy Leerhoff wrote: > All you have to do is install the imaging piece on the secondary server. OK .. that should...

Web resources about - Identify file size of remote image on a image, without having to copy file to local file system - asp.net.web-forms

Stop and identify statutes - Wikipedia, the free encyclopedia
to detain persons and request such persons to identify themselves, and arrest them if they do not. The authority to detain on reasonable suspicion ...

New Louisiana Law: Sex Offenders Must Identify As Such On Facebook
A new Louisiana law aimed at sex offenders mandates that they must identify their criminal status on Facebook and other social media sites. The ...

Facebook launches verified pages and profiles to help users identify authentic accounts
Facebook today announced the launch of verified pages and profiles, which will make it easier for users to find official fan pages and accounts ...

Feds identify 2 killed in New Mexico plane crash - KRQE News 13
The U.S. Department of Agriculture says a pilot with the Wildlife Services program and a state wildlife specialist died when their plane cra… ...

Missed opportunities to identify high value Customers - Virgin Atlantic case study
... you can get. I really fly a lot! On my briefcase and all my bags I have the Delta Diamond tags. This is like Missed opportunities to identify ...

Identify Things on the App Store on iTunes
Get Identify Things on the App Store. See screenshots and ratings, and read customer reviews.

After Paris Attack Fox Anchor Shannon Bream Suggests Skin Color Can Help Identify Typical Bad Guys ...
Fox News anchor and Supreme Court correspondent Shannon Bream reacted to a Paris terror attack by suggesting certain skin tones are more typical ...

Dubai Police in appeal to identify dead man - The National
Dubai Police have appealed to the public to try to identify a man whose body was found recently.

Minister for women doesn't have to identify as feminist, says Senator Michaelia Cash
The federal minister responsible for women says it is "ridiculous" that identifying as a feminist should be a prerequisite for her job.

Minister for women doesn't have to identify as feminist, says Senator Michaelia Cash
The federal minister responsible for women says it is &quot;ridiculous&quot; that identifying as a feminist should be a prerequisite for her ...

Resources last updated: 1/18/2016 10:16:55 PM