【问题标题】:filepath for a image in server is not working服务器中图像的文件路径不起作用
【发布时间】:2013-09-05 13:10:43
【问题描述】:

我正在创建一个 PHP 文件,我在其中压缩存在于服务器文件夹中的图像(使用 php func)并将压缩文件放入另一个文件夹。现在的问题是我需要为两个文件夹指定路径,对于源文件夹,我只是给出了:

HTTP://ipadrs/images/properties/thumbs_400/image_name (given "http "as HTTP purposely)

我使用fopen 函数检查了该图像是否存在于文件夹中,并且它工作正常。我还在 thumbs_400 之后给出了相同的路径,并在其后附加了“/compress_50/”,但图像没有在 resp 文件夹中被压缩;相同的 {H{ 文件在 localhost 中运行良好。

谁能告诉我为什么会这样,解决办法是什么?

编辑:(代码张贴在 cmets)

$img = HOME."images/properties/thumbs_400/".$sqlrow['plan_image_name']." "; 
$handle = fopen($img, "r"); 

if ($handle) { 
    $dest = HOME."images/properties/thumbs_400/compress_50/".$sqlrow['plan_image_name']." ";

【问题讨论】:

  • 不应该是HTTP://而不是HTTP//吗?
  • 这个网站不允许我把while张贴问题,所以我故意写了它。仅此而已,在我的文件中,我仅将其指定为 http://
  • 除非ipadrs 实际上是IP地址,否则无论是否带有:,这都不是有效的URL。添加一些代码,以便我们可以看到您要执行的操作。
  • @Buggabill 我只在 ma 代码中将它作为 http:// 给出,对于代码你可以检查我在下面发布的 cmets,抱歉很难添加。

标签: php filepath


【解决方案1】:

除非是打字错误,否则替换:

HTTP//ipadrs/images/properties/thumbs_400/image_name

与:

http://ipadrs/images/properties/thumbs_400/image_name

【讨论】:

  • 这个网站不允许我把while发帖问,所以我故意写了它。仅此而已,在我的文件中,我仅将其指定为 http://
  • 哦,好的。那么您能否向我们附加一些您的代码?没有任何代码很难猜出问题!
  • $img = HOME."images/properties/thumbs_400/".$sqlrow['plan_image_name']." "; $handle = fopen($img, "r"); if ($handle) { $dest =HOME."images/properties/thumbs_400/compress_50/".$sqlrow['plan_image_name']." ";
  • 评论有限制,所以我这里只添加了相关代码,HOME是ipaddress,$sqlrow是图片名称
  • 您能告诉我们回显代码是什么吗?另外,查询中是否包含图像的格式? fopen 也需要格式! (例如:您不能提供诸如 HOME./location/filename 之类的链接!它需要类似于:home./location/filename.format!例如:如果您有 .png 图像,请尝试添加“.png”在 $sqlrow['plan_image_name'] 之后!
猜你喜欢
  • 1970-01-01
  • 2011-05-26
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2018-01-27
  • 2020-04-29
相关资源
最近更新 更多