php - timthump 如何与查询字符串 url 一起使用

标签 php javascript css image

我正在使用 timthump.php,它在使用中非常方便,但我们使用它时遇到问题,我们无法提供标准的图像位置 url。

在我们的情况下,我们将图像保存在数据库中,然后我设计了一个 php 页面,该页面从查询字符串中读取 id 或名称,然后将图像呈现为响应。在我们需要获取图像的地方,我们使用。

getmemberimg.php?id=1

虽然 timthumb 语法看起来像这样。

timthumb.php?src=image.jpeg

timthumb.php?src=https://xyzsite.com/image.jpeg

现在当我把我的 url 写成

timthumb.php?src=getmemberimg.php?id=1
timthumb.php?src=https://mysite.com/getmemberimg.php?id=1

这不起作用并返回错误。

如何克服这个问题?我的问题是如何将我的图像传递给 timthumb.php 而我可以使用 getmemberimg.php?id=1... 获取图像

最佳答案

我不知道 timthumb.php 是什么。但是,如果您想获取网页的输出(例如来自 getmemberimg.php?id=X 的图像),您可以使用 file_get_contentscurl.


文件获取内容:

Show image using file_get_contents

http://php.net/manual/en/function.file-get-contents.php


curl :

http://www.bitrepository.com/download-image.html

http://php.net/manual/en/book.curl.php

关于php - timthump 如何与查询字符串 url 一起使用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17058957/

相关文章:

php - apache/2.4.29 (ubuntu) 服务器在 localhost 端口 80

php - 每次我尝试创建一个新表时,mysql 都会死掉

javascript - 在主干中更改 url

javascript - iphone/ios 中心的按钮文本

javascript - CSS - 将页面水平分成两半

php - 如何在 PHP 中扫描

php - Phalcon 中的翻译工具

javascript - 令人困惑的 Javascript 引号

javascript - 如何从nodeJS中的XML解析器获取数据

javascript - removeAttr() 和 remove() 不起作用