Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Image JPG Handler

Image JPG Handler

Scheduled Pinned Locked Moved ASP.NET
sysadminhelpquestion
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    RX Maverick
    wrote on last edited by
    #1

    I would like to make a HttpHandler that looks for querystring and edits the image (let's say jpg) as specified. I can do all this and it works great. My issue is since every JPG is being sent to the handler what do I do if I want it to not do anything? I tried to Server.Transfer to the requested image when the querystring is 0 but that basically makes a loop. I figure I can have the handler read the file image then save it to the output stream with no edits but I don't want the server doing the extra work for nothing. Is there and easy way to do this? Is to a lot of extra work for the server to read and dispose rather than just hand the file over? Is there a better way to write the Web.config (currently I have modified on Sunday, October 5, 2008 12:19 PM

    N 1 Reply Last reply
    0
    • R RX Maverick

      I would like to make a HttpHandler that looks for querystring and edits the image (let's say jpg) as specified. I can do all this and it works great. My issue is since every JPG is being sent to the handler what do I do if I want it to not do anything? I tried to Server.Transfer to the requested image when the querystring is 0 but that basically makes a loop. I figure I can have the handler read the file image then save it to the output stream with no edits but I don't want the server doing the extra work for nothing. Is there and easy way to do this? Is to a lot of extra work for the server to read and dispose rather than just hand the file over? Is there a better way to write the Web.config (currently I have modified on Sunday, October 5, 2008 12:19 PM

      N Offline
      N Offline
      NeverHeardOfMe
      wrote on last edited by
      #2

      well, *something* has to handle the request - if not your custom handler then .NET itself, so as long as you pass it straight back if no editing is required I wouldn't worry too much... If [condition] Then ' amend image ...Save(context.Response.OutputStream, System.Drawing.Imaging.ImageFormat.Jpeg) Else ' send original image straight to browser context.Response.ContentType = "image/jpeg" context.Response.WriteFile([FilePath]) End If Otherwise, if you can separate your images into different folders such that all those that need amending are all in a particular folder then you can re-write the path="*.jpg" attribute in your web.config accordingly...

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups