Cocoahttpserver 从 iPhone App Bundle 提供图像

发布于 2024-08-09 18:06:08 字数 249 浏览 3 评论 0原文

我无法从 Duesty Designs(很棒的 CocoaAsyncSocket 开源库制造商)获取 Cocoahttpserver 来提供我的应用程序包中的图像。使用示例 iPhone 项目,我可以从项目中的 Resources 目录提供一个 html 文件,但引用的图像如下:

<img src='foo.png' />

不会呈现。

有谁知道为什么或者我需要做什么才能使这项工作成功?

I am having trouble getting Cocoahttpserver from Duesty Designs (awesome open source library makers of CocoaAsyncSocket) to serve images from my app bundle. Using the example iPhone project I can serve up an html file from the Resources dir in my project, but images refernced like:

<img src='foo.png' />

are not rendered.

Does anyone know why or what I need to do to make this work?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

猫性小仙女 2024-08-16 18:06:08

资源目录中的 PNG 图像以一种时髦的格式编码。 modmyi 有一篇关于该主题的好文章

我的方法可能是用 .png_unconverted 命名它们,并重写 Cocoahttpserver 中的代码,将 .png 的请求转换为 .png_unconverted

另一个解决方案是调查构建系统中的 CopyPNGFile 规则,看看是否可以通过转换来完成它(但是,这可能会导致无法从应用程序内渲染 PNG)。

最后,您可以切换到 JPEG。我不相信这些文件被修改。

PNG images in your Resources directory are encoded in a funky format. modmyi has a good article on the subject.

My approach would probably be to name them with .png_unconverted, and rewrite the code in Cocoahttpserver to translate requests for .png into .png_unconverted.

Another solution would be to investigate the CopyPNGFile rule in the build system and see if you can get it to knock it off with the converting (this will probably make it impossible to render the PNG from within your app, however).

Finally, you could switch to JPEG. I don't believe that these files get modified.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文