Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re^2: How to download JUST the first X bytes of HTTP response ?

by fx (Pilgrim)
on Dec 09, 2010 at 15:16 UTC ( [id://876270]=note: print w/replies, xml ) Need Help??


in reply to Re: How to download JUST the first X bytes of HTTP response ?
in thread How to download JUST the first X bytes of HTTP response ?

In case anyone's interested, I had a go with some code using this method and it worked with only the specified bytes coming down the line.

However, with specific reference to OP's requirement, I've found that the EXIF portion of a JPEG file isn't a fixed length and for very large JPEGs can be larger than you expect... A few tests I ran (as I'm finding this thread particularly interesting...) showed that sometimes over 10K of download was needed before ExifTool would recognise the EXIF data...

fx, Infinity is Colourless

  • Comment on Re^2: How to download JUST the first X bytes of HTTP response ?

Replies are listed 'Best First'.
Re^3: How to download JUST the first X bytes of HTTP response ?
by BrowserUk (Patriarch) on Dec 09, 2010 at 15:43 UTC

    Indeed. I just inspected a .jpg at random and it contained the EXIF data shown below. The first field (OLYMPUS DIGITAL CAMERA) starts at offset 0xbc; and the last (JpegIFByteCount - 8092) ends at 0x2a19. On the scant basis of those two images--yours and mine--10k seem like a good starting point. For this image, that is still a substantial saving over the 677kb for the full image.

    ImageDescription - OLYMPUS DIGITAL CAMERA Make - OLYMPUS CORPORATION Model - E-1 Orientation - Top left XResolution - 314.00 YResolution - 314.00 ResolutionUnit - Inch Software - Adobe Photoshop CS4 Windows DateTime - 2010:08:22 16:33:44 YCbCrPositioning - Co-Sited ExifOffset - 540 ExposureTime - 1/800 seconds FNumber - 6.30 ExposureProgram - Aperture priority ISOSpeedRatings - 200 ExifVersion - 0221 DateTimeOriginal - 2010:08:22 11:15:59 DateTimeDigitized - 2010:08:22 11:15:59 ComponentsConfiguration - YCbCr ExposureBiasValue - 0.00 MaxApertureValue - F 3.50 MeteringMode - Spot LightSource - Auto Flash - Not fired FocalLength - 14 mm UserComment - FlashPixVersion - 0100 ColorSpace - sRGB ExifImageWidth - 2560 ExifImageHeight - 1920 InteroperabilityOffset - 1120 FileSource - DSC - Digital still camera CustomRendered - Normal process ExposureMode - Auto White Balance - Auto DigitalZoomRatio - 0.00 x SceneCaptureType - Standard GainControl - Low gain up Contrast - Normal Saturation - Normal Sharpness - Normal Thumbnail: - Compression - 6 (JPG) XResolution - 72 YResolution - 72 ResolutionUnit - Inch JpegIFOffset - 1246 JpegIFByteCount - 8092

    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://876270]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (3)
As of 2024-04-26 05:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found