5 Replies Latest reply on Jan 14, 2015 9:17 AM by rstory

    PHP Configuration for FM11 Server -- getimagesize() not working

    rstory

      Hi all,

       

      I've spent a bit of time googling this and I thought maybe someone here might have encountered the same problem.

       

      Let's say I have the following php script:

       

      <?php

      $imgURL = 'http://example.com/filemakerstuff/ContainerBridge.php?path=%2Ffmi%2Fxml%2Fcnt%2Fdata.jpg%3F-db%3DMyDB%26amp%3B-lay%3DPictures%26amp%3B-recid%3D93%26amp%3B-field%3DPhoto%281%29';

       

      echo "<p>imgURL: $imgURL</p>";

      echo "<img src=\"$imgURL\"><br />";

       

      echo "<p>by URL:</p>";

      list($imgWidth, $imgHeight, $imgtype, $attr) = getimagesize($imgURL);

      echo "<strong>imgWidth:</strong> $imgWidth<br />

        <strong>imgHeight:</strong> $imgHeight<br />

        <strong>imgType:</strong> $imgtype<br />

        <strong>attr:</strong> $attr<br />";

       

      echo "<p>by Static Image:</p>";

      list($imgWidth, $imgHeight, $imgtype, $attr) = getimagesize("local_image.png");

      echo "<strong>imgWidth:</strong> $imgWidth<br />

        <strong>imgHeight:</strong> $imgHeight<br />

        <strong>imgType:</strong> $imgtype<br />

        <strong>attr:</strong> $attr<br />";

      ?>

       

      When I load this page into the example.com server which is running FM11 server with the FileMaker PHP installation, I get the following response:

       

      imgURL:  http://example.com/filemakerstuff/ContainerBridge.php?path=%2Ffmi%2Fxml%2Fcnt%2Fdata.jpg%3F-db%3DMyDB%26amp%3B-lay%3DPictures%26amp%3B-recid%3D93%26amp%3B-field%3DPhoto%281%29

       

       

      by URL:

       

      Warning: getimagesize(http://example.com/filemakerstuff/ContainerBridge.php?path=%2Ffmi%2Fxml%2Fcnt%2Fdata.jpg%3F-db%3DMyDB%26amp%3B-lay%3DPictures%26amp%3B-recid%3D93%26amp%3B-field%3DPhoto%281%29) [function.getimagesize]: failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found in [php script] on line 9

      imgWidth:

      imgHeight:

      imgType:

      attr:


      By Static Image:


      imgWidth: 662

      imgHeight: 163

      imgType: 3

      attr: width="662" height="163"


      The fact that the image renders from the <img> call indicates that the url is fine, ContainerBridge is serving properly, etc.


      So this is where it gets interesting:


      In my development environment of PHP, which is NOT the filemaker configuration, the getimagesize function works fine and so I was happily programming away thinking it would transfer fine to the example.com server. So I started digging and found some indication that the GD library needed to be enabled, so I went into the php.ini file in the FM Server directory (on the example.com server) and uncommented that extension, restarted the server, and confirmed via phpinfo() that GD was working fine (and that cURL is working as well). But the script is still having trouble with this function, and I'm a little flummoxed. The image is definitely available, and my development environment had no trouble running the getimagesize() function off of a url. I'm pretty sure I just need to update/enable some environment variable, but I don't know what that might be. Any thoughts?