我在nginx上运行一个PHP网站,并使用phpthumb生成缩略图。该网站通过亚马逊云前端展示。
这里的问题是phpthumb不返回缩略图,而是返回默认(no_image.png)错误图像(在日志中也找不到任何有意义的错误)。
请告诉我,当通过cdn(如cloudfront)进行连接时,是否需要在phpThumb中进行任何特殊配置
是否有任何特定的方法在调试模式下运行phpthumb,以便我可以看到导致问题的完整错误消息?
----------下面给出了云前端日志的踪迹--------
2015-12-10 05:51:10 SIN2 1116 112.135.54.88 GET d3aaaaaav9caaap.cloudfront.net /includes/phpthumb/no_image.png 200 https://mywebsite.com/product.php?id=63 Mozilla/5.0%2520(Windows%2520NT%25206.1;%2520WOW64;%2520rv:42.0)%2520Gecko/20100101%2520Firefox/42.0 - - Miss G2o7oqMRRa89J6Z-mdnizSx9GwBbV6PqJSl1IuhMGoZ-2nj5rJbWIw== mywebsite.com https 736 0.178 - TLSv1.2 ECDHE-RSA-AES128-GCM-SHA256 Miss
2015-12-10 05:51:10 SIN2 1354 112.135.54.88 GET d3aaaaaav9caaap.cloudfront.net /images/trans_white_60.png 200 https://mywebsite.com/css/styles.css Mozilla/5.0%2520(Windows%2520NT%25206.1;%2520WOW64;%2520rv:42.0)%2520Gecko/20100101%2520Firefox/42.0 - - Miss zrJvbg9LKZ3SJMA32vrXrn12mJKbaytLBgVOH0fDvpmIGlwp_x1PfA== mywebsite.com https 720 0.178 - TLSv1.2 ECDHE-RSA-AES128-GCM-SHA256 Miss
2015-12-10 05:51:08 SIN2 95281 112.135.54.88 GET d3aaaaaav9caaap.cloudfront.net /scripts/jquery.js 200 https://mywebsite.com/product.php?id=63 Mozilla/5.0%2520(Windows%2520NT%25206.1;%2520WOW64;%2520rv:42.0)%2520Gecko/20100101%2520Firefox/42.0 - - Miss lBuPYl9KPv138__Ll455aXlX6vjd4eOtVXrkm8jahqWWfPle_ahT1Q== mywebsite.com https 687 1.519 - TLSv1.2 ECDHE-RSA-AES128-GCM-SHA256 Miss
2015-12-10 05:51:10 SIN2 416 112.135.54.88 GET d3aaaaaav9caaap.cloudfront.net /includes/phpthumb/phpthumb.php 302 https://mywebsite.com/product.php?id=63 Mozilla/5.0%2520(Windows%2520NT%25206.1;%2520WOW64;%2520rv:42.0)%2520Gecko/20100101%2520Firefox/42.0 src=images/products/mw-rt300(2).png&w=215&h=215&zc=1 - Miss g6665DnogX53Gm0-ZyOxrxKSO023HXz4MAnr_k5v9kJo6GtFB8O6qg== mywebsite.com https 700 0.190 - TLSv1.2 ECDHE-RSA-AES128-GCM-SHA256 Miss
答案 0 :(得分:0)
花了好几个小时后,我才找到了问题。问题显然与图像的路径有关。 (我知道这很愚蠢)
<img src="includes/phpthumb/phpthumb.php?src=images/products/myimage.png&w=215&h=215&zc=1">
我只需将“../../”附加到下面给出的图像路径,它就解决了问题。
<img src="includes/phpthumb/phpthumb.php?src=../../images/products/myimage.png&w=215&h=215&zc=1">
如果phpThumb显示正确的错误消息,这可能会容易得多。