tags:

views:

24

answers:

1

Hi all:

I'm trying to get the largest image off a page I parse with Hpricot and am not having any luck. How do I access the width and height attributes of an img tag with it?

Thanks...Chris

A: 

Unless it's in the mark-up you won't be able to access the file details through hpricot.

An alternative is to use hpricot to return you all src attributes to the images, then loop through requesting these, you can parse the response as an image and access the properties on these actual image files.

hemal
yes that would be the most accurate however I just need to determine the largest image on the page and if the attributes aren't there then i will just skip that image. so how would I use hpricot to get the width/height attributes? Thanks!
thinkfuture
is there any way to get the image attributes using hpricot?
thinkfuture