Hi Angelo,

Ah that makes sense.  When I used something like curl, it did the see
the text output.  Thanks for the help.

On Jan 14, 8:37 am, Angelo Gladding <[email protected]> wrote:
> Raw HTTP response from a request 
> tohttp://dev.hermanradtke.com:8881/imagedoesnotexist.jpgshows:
>
> HTTP/1.1 200 OK
>
> > Transfer-Encoding: Identity
> > Connection: close
> > Date: Thu, 14 Jan 2010 16:24:00 GMT
> > Server: CherryPy/3.1.2 WSGI Server
>
> > Hello, world!
>
> Your browser is expecting an image and thus attempting to render "Hello,
> World!" as a jpeg. When Firefox (my browser) fails to render an image it
> just renders the URI instead, as I experience when I hit your site.
>
> I suspect that if you just output your image data in place of "Hello,
> World!" you'll be fine, regardless of the presence of a Content-Type header.
>
> Have you left the `hello` handler to resolve first in the urls map?
>
> urls = (
>   "/.*", "hello",
>   "/(\d{1,4})x(\d{1,4})/(.*)", "Resize"
> )
>
> If so, `hello` will be used first. Can you present your code as it looks
> now?
>
>
>
> On Wed, Jan 13, 2010 at 10:11 PM, Herman <[email protected]> wrote:
> > Hi Angelo,
>
> > I tried that, but it does not seem to work.
>
> > Hit the following URL:
> >http://dev.hermanradtke.com:8881/imagedoesnotexist.jpg
>
> > Or make any URL pointing to that domain with a .jpg|.gif|.png|.zip
> > extension.  It just serves back up a page with my url as showing and a
> > content type that matches the extension.
>
> > On Jan 13, 5:03 pm, Angelo Gladding <[email protected]> wrote:
> > > Not sure what your problem is. What do you mean by "fake file"?
>
> > > Maybe this will help you get started. The PIL API I'm using is
> > fictitious.
> > > Replace with correct API.
>
> > > resources = (
> > >   '/(\d{1,4})x(\d{1,4})/(.*)', 'Resize'
> > > )
>
> > > class Resize:
> > >   def GET(self, width, height, image):
> > >     new_image = PIL.image(image)
> > >     new_image.resize(width=width, height=height)
> > >     web.header('Content-Type', new_image.type) # image/jpeg
> > >     return new_image.data
>
> > > On Wed, Jan 13, 2010 at 8:45 AM, Herman <[email protected]> wrote:
> > > > My intention was to use PIL to size images just in time.  So I get a
> > > > URL like "http://example.com/50x20/foo.jpg";.  I want process this
> > > > request and send back a jpg file.  It works fine now if I don't use
> > > > a .jpg extension, but that is not allowed by requirements.
>
> > > > On Jan 13, 6:22 am, jlist9 <[email protected]> wrote:
> > > > > I suppose you can check in GET() to see if the file exists,
> > > > > and if not, return a 404?
>
> > > > > On Tue, Jan 12, 2010 at 10:30 PM, Herman <[email protected]>
> > wrote:
> > > > > > I want to proxy image files through webpy.  I have a very simple
> > > > > > index.py that I am testing with, but webpy is automagically serving
> > up
> > > > > > fake image files before I can process them.
>
> > > > > > index.py:
> > > > > > import web
>
> > > > > > urls = ("/.*", "hello")
> > > > > > app = web.application(urls, globals())
>
> > > > > > class hello:
> > > > > >    def GET(self):
> > > > > >        return 'Hello, world!'
>
> > > > > > if __name__ == "__main__":
> > > > > >    app.run()
>
> > > > > > Output from webserver:
> > > > > > $ ./index.py 192.168.1.3:8881
> > > > > >http://192.168.1.3:8881/
> > > > > > 192.168.1.5:50327 - - [12/Jan/2010 22:21:00] "HTTP/1.1 GET
> > /foo.jpg" -
> > > > > > 200 OK
>
> > > > > > My web output:
> > > > > >http://192.168.1.3:8881/foo.jpg
>
> > > > > > How can I prevent webpy from serving up this fake file?
>
> > > > > > --
> > > > > > You received this message because you are subscribed to the Google
> > > > Groups "web.py" group.
> > > > > > To post to this group, send email to [email protected].
> > > > > > To unsubscribe from this group, send email to
> > > > [email protected]<webpy%[email protected]><
> > webpy%[email protected]<webpy%[email protected]>
> > >.
> > > > > > For more options, visit this group athttp://
> > > > groups.google.com/group/webpy?hl=en.
>
> > > > --
> > > > You received this message because you are subscribed to the Google
> > Groups
> > > > "web.py" group.
> > > > To post to this group, send email to [email protected].
> > > > To unsubscribe from this group, send email to
> > > > [email protected]<webpy%[email protected]><
> > webpy%[email protected]<webpy%[email protected]>
> > >.
> > > > For more options, visit this group at
> > > >http://groups.google.com/group/webpy?hl=en.
>
> > > --
> > > Angelo Gladding
> > > [email protected]http://angelo.gladding.name/
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "web.py" group.
> > To post to this group, send email to [email protected].
> > To unsubscribe from this group, send email to
> > [email protected] <webpy%[email protected]>.
> > For more options, visit this group at
> >http://groups.google.com/group/webpy?hl=en.
>
> --
> Angelo Gladding
> [email protected]http://angelo.gladding.name/
-- 
You received this message because you are subscribed to the Google Groups 
"web.py" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/webpy?hl=en.


Reply via email to