dongyunwei8596 2012-02-08 01:33 采纳率: 100%
浏览 35
已采纳

设置要在浏览器中显示的图像文档的标题

I have an applicaton written in PHP that retrieves files from mongoDB Grid collection, and allows a user to view/download them based on if they're an image or not.

It's all working fine, except that the title bar of the browser displays the name of the php file I'm running the script in, rather than the filename of the image that's displayed. for example:

myphpfile (JPEG 1024 X 768 pixels)

I'm not sure if it's possible, but I'd like to change it if it is. If I right-click and select save as I get the correct image name, as user header() I've set:

content-disposition: inline; filename="thefilename"

I've also tried setting name with the content-type with no success.

Thanks for any help.

  • 写回答

1条回答 默认 最新

  • douzhiba6873 2012-02-08 02:36
    关注

    The only possible way is not to open image directly in the browser's window, but a simple HTML code like this:

    <html>
    <head>
    <title>
    Put your title here
    </title>
    </head>
    <body>
    <img src='your_script_generating_images.php?parameters'>
    </body>
    </html>
    

    But did you think about some fancy and nice solutions like http://highslide.com/ or http://fancybox.net/? All that you need is to set the links to your script generating images and to update the page title correspondingly (which is not even required as you can write information you want just above the image in popup).

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥20 神经网络Sequential name=sequential, built=False
  • ¥16 Qphython 用xlrd读取excel报错
  • ¥15 单片机学习顺序问题!!
  • ¥15 ikuai客户端多拨vpn,重启总是有个别重拨不上
  • ¥20 关于#anlogic#sdram#的问题,如何解决?(关键词-performance)
  • ¥15 相敏解调 matlab
  • ¥15 求lingo代码和思路
  • ¥15 公交车和无人机协同运输
  • ¥15 stm32代码移植没反应
  • ¥15 matlab基于pde算法图像修复,为什么只能对示例图像有效