Results 1 to 3 of 3

Thread: image handler to itextshart.text.image

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Nov 2000
    Location
    Minnesota
    Posts
    830

    image handler to itextshart.text.image

    Using iTextSharp, I can get a normal image (http://www.domain.com/name.jpg) added fine but if I create a generic handler to re-size a image and add a watermark it doesn't seem to work. Here is what I am doing:
    Code:
     Dim sFullImgUrl As String = "http://www.domain.com/ThumbnailHandler.ashx?id=1234&thumb=yes"
     Dim imgItem As iTextSharp.text.Image = iTextSharp.text.Image.GetInstance(New Uri(sFullImgUrl))
    This returns 'IOException was unhandled' and says the url is 'not a recognized imageformat'.

    Then I tried:

    Code:
     Dim sFullImgUrl As String = "http://www.domain.com/ThumbnailHandler.ashx?id=1234&thumb=yes"
     Using wc As New Net.WebClient
                Dim img As System.Drawing.Image = System.Drawing.Image.FromStream(wc.OpenRead(sFullImgUrl))
     End Using
    This returns 'ArgumentException was unhandled' and says 'Parameter is not valid'.

    Any other thoughts on how to use my handler to use with iTextSharp?

  2. #2
    PowerPoster dunfiddlin's Avatar
    Join Date
    Jun 2012
    Posts
    8,245

    Re: image handler to itextshart.text.image

    http://www.domain.com/ThumbnailHandl...1234&thumb=yes manifestly is not an image file. The error is therefore exactly what you'd expect. Your url has to point to an actual image file not to a way to get to an image file.
    As the 6-dimensional mathematics professor said to the brain surgeon, "It ain't Rocket Science!"

    Reviews: "dunfiddlin likes his DataTables" - jmcilhinney

    Please be aware that whilst I will read private messages (one day!) I am unlikely to reply to anything that does not contain offers of cash, fame or marriage!

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Nov 2000
    Location
    Minnesota
    Posts
    830

    Re: image handler to itextshart.text.image

    Is there a way to use the Intelligencia.UrlRewriter.RewriterHttpModule to find a solution?

    I tried to add a new rewriter rule in my web.config like so but didn't work as well. Returns with 'The system cannot find the path specified.'
    Code:
    <rewrite url="~/catalog/images/thumb/(\d+)/default.jpg" to="/ThumbnailHandler.ashx?id=$1&amp;thumb=yes" />
    Is this not possible as well?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width