0

I',m running a PHP website on nginx and use phpthumb to generate thumbnail images. This web site is exposed via amazon-cloud front.

The issue here is that the phpthumb does not return the thumbnail image, instead it returns the default (no_image.png) error image (couldn't find any meaningful errors in the logs as well).

Please tell me if it is required to have any special configuration in phpThumb when connecting via a cdn such as cloudfront

Is there any specific way to run the phpthumb in the debug mode so that I can see the full error message causing the problem?

----------Given below is the trace of cloud front log--------

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
Asanga Dewaguru
  • 1,058
  • 2
  • 16
  • 31

1 Answers1

0

After spending hours on this I've just managed to find the issue. issue was clearly with the path to the image. (I know it's stupid)

<img src="includes/phpthumb/phpthumb.php?src=images/products/myimage.png&amp;w=215&amp;h=215&amp;zc=1">

I just had to append the "../../" to the path of the image as given below and it solved the problem.

<img src="includes/phpthumb/phpthumb.php?src=../../images/products/myimage.png&amp;w=215&amp;h=215&amp;zc=1">

This could have been much easier if there is a proper error message shown by phpThumb.

Asanga Dewaguru
  • 1,058
  • 2
  • 16
  • 31