Hi Martyn! 2014年5月26日 上午6:30于 "Martyn Smith" <[email protected]>写道: > > Hi guys, > > I am attempting to create a website as part of a learning experience with guile. The code is originally based from ideas in https://www.gnu.org/software/guile/manual/html_node/Web-Examples.html. My code has progressed since the "Web Examples" page to support a more MVC style. So far, so good-ish. :-) >
If you want to play web with Guile, I suggest Artanis, which is a web framework for it. It's easier than using the lower web api. www.web-artanis.com > Getting to the point of the email -- I am a bit confused how I would return a jpg image. For example: - > <img src="/load-image?id=1234" /> > > The "1234" tells me which file to load and return. > > Being primarily a .NET developer, I am struggling to understand how to achieve such goal in guile. I have tried things like (read-file "/location/to/image.jpg" "r") but no luck. Also tried to understand converting to bytes in the documentation but again... no luck. Always getting a 500 error. Yes, I have included (content-type . (image/jpg)) etc. > Please attache you complete code. But I guess what you need is get-bytevector-all which dwells on (rnrs). Usually, open file only return a file port, you have to read the content then. > Can anyone give me a heads up on how to do such thing? How would I open the jpg file? How would it be returned? > > I don't think its worth providing any code here. I think the Web-Examples page is the best place to review code, and how I would return an image from that current codebase, etc. > > Thanks for any suggestions. > > mart
