2 Replies Latest reply on Jun 9, 2006 12:47 PM by jamesmd

    Running PHP script via ColdFusion

    jamesmd
      I'm running CFMX 7 on a Solaris platform with PHP 5.0.5.

      I need to determine the width and height of an uploaded image to ensure that the file can be reasonably used on a web page. I have scoured the Internet and found a numer of solutions to this. Most need the installation of additional software on our server and the creation of a custom tag. These are doable, but would require additional effort I don't have time for at the moment. Also, the software to install is a full image manipulation package that is definitely overkill for my needs. Kind of like threading a needle with a hammer.

      On the other hand I know that PHP has a command called "getimagesize" that would be perfect for my use. This would be much more simple and elegant. And I have created a small program (see below) that can accept a location of an image file and display the width and height of the image as a result. The code is:

      <?php
      list($width, $height) = getimagesize($argv[1]);
      echo "$width, $height";
      ?>

      I've tested it via the command line and it works fine. However, I'm having difficulty in running it via the ColdFusion cfexecute tag. Here is that code:

      <cfsavecontent variable="imgsize">
      <cfexecute name="#phpfilelocation#" arguments="#imagelocation#"></cfexecute>
      </cfsavecontent>

      I get nothing back from this. I've also tried the cfhttp tag with similar results. It seems to me that the argument (the location of the image) is not being accepted by the PHP code for some reason.

      I've looked for a solution to this within this forum and via Google, etc. to no avail. There is apparently something about PHP or ColdFusion that is escaping me. Any help clarifying why this is not working and (hopefully) a workaround would be very much appreciated. Thank you.