Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > Newby Question: Check image size before getting with Net::Http

Reply
Thread Tools

Newby Question: Check image size before getting with Net::Http

 
 
Ruchira Bomiriya
Guest
Posts: n/a
 
      05-30-2008
Dear Expert,

I want to check the file size of a URI to identify large files (I will
decide on threshold) without having to get the whole file first.

Can I get just the file size using something related to Net::Http
(don't know if Propfind would help and if it does how).

Thanks in advance.
Ruchira
 
Reply With Quote
 
 
 
 
Heesob Park
Guest
Posts: n/a
 
      05-30-2008
Hi,

2008/5/30 Ruchira Bomiriya <(E-Mail Removed)>:
> Dear Expert,
>
> I want to check the file size of a URI to identify large files (I will
> decide on threshold) without having to get the whole file first.
>
> Can I get just the file size using something related to Net::Http
> (don't know if Propfind would help and if it does how).
>


require 'net/http'

response = nil
Net::HTTP.start('www.biostat.wisc.edu', 80) {|http|
response = http.head('/bcg/categories/languages/ruby/ruby_logo.png')
}
p response['content-length']



Regards,

Park Heesob

 
Reply With Quote
 
 
 
 
Ruchira Bomiriya
Guest
Posts: n/a
 
      05-30-2008
On May 30, 7:52 am, Heesob Park <(E-Mail Removed)> wrote:
> Hi,
>
> 2008/5/30 Ruchira Bomiriya <(E-Mail Removed)>:
>
> > Dear Expert,

>
> > I want to check the file size of a URI to identify large files (I will
> > decide on threshold) without having to get the whole file first.

>
> > Can I get just the file size using something related to Net::Http
> > (don't know if Propfind would help and if it does how).

>
> require 'net/http'
>
> response = nil
> Net::HTTP.start('www.biostat.wisc.edu', 80) {|http|
> response = http.head('/bcg/categories/languages/ruby/ruby_logo.png')
> }
> p response['content-length']
>
> Regards,
>
> Park Heesob


Thank you very much Park.
Ruchira
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
mega pixels, file size, image size, and print size - Adobe Evangelists Frank ess Digital Photography 0 11-14-2006 05:08 PM
Newby: how to check if a module is loaded in linux insomniux C++ 4 03-16-2006 02:10 PM
Help with image size before taking image to printer. Mr. Rather B. Beachen Digital Photography 6 07-05-2004 10:35 AM
Check if image file exists before linking to Image object Filip De Backer ASP .Net Web Controls 0 06-11-2004 07:24 AM
Bigger image size and lower quality vs. Smaller image size and higher quality Desmond Digital Photography 5 09-27-2003 04:08 AM



Advertisments