• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Running PHP script via ColdFusion

Community Beginner ,
Jun 09, 2006 Jun 09, 2006

Copy link to clipboard

Copied

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.
TOPICS
Advanced techniques

Views

917

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Beginner , Jun 09, 2006 Jun 09, 2006
Perfect! That's exactly what I needed, thank you.

Votes

Translate

Translate
Guest
Jun 09, 2006 Jun 09, 2006

Copy link to clipboard

Copied

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jun 09, 2006 Jun 09, 2006

Copy link to clipboard

Copied

LATEST
Perfect! That's exactly what I needed, thank you.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation