Jump to content

Display image from database


This topic is 4748 days old. Please don't post here. Open a new topic instead.

Recommended Posts

  • Newbies

Hi, i have php api installed on a seperate web server from the filemaker pro database server.

For example web server address 160.169.82.9, filemaker pro database server 160.169.82.10

I have the following script on web server called img.php

<?php

require_once("FileMaker.php");

$databaseName = 'test';

$userName = 'test';

$passWord = 'test';

$serverAddress = '160.169.82.10';

$fm = & new FileMaker();

$fm->setProperty('database',$databaseName);

$fm->setProperty('hostspec', $serverAddress);

$fm->setProperty('username',$userName);

$fm->setProperty('password',$passWord);

if (isset($_GET['-url']))

{

$url = $_GET['-url'];

$url = substr($url, 0, strpos($url, "?"));

$url = substr($url, strrpos($url, ".") + 1);

if($url == "jpg"){

header('Content-type: image/jpeg');

}

else if($url == "gif"){

header('Content-type: image/gif');

}

else{

header('Content-type: application/octet-stream');

}

echo $fm->getContainerData($_GET['-url']);

}

?>

Then i visit:

http://160.169.82.9/img.php?-url=%2Ffmi%2Fxml%2Fcnt%2Fdata.jpg%3F-db%3DAppel%2520Tradecards.fp7%26amp%3B-lay%3DData%2520Entry%26amp%3B-recid%3D2184%26amp%3B-field%3DImage%2520web%281%29

*** The read text is a valid url point to the image in the database(I hard coded for testing purpose)

It doesn't show the image from database, and no error code as well.

But, if i put the exactly same script on to filemaker pro server(which also have ISS installed), then it shows up the image from the database.

From my thought, i think the function getContainerData() doesn't work on the web server(separate from the FM server), and it works if the script hosted on the same machine as FM server. I do have FileMaker.php and FileMaker api folder on web server, i'm pretty sure this script connected to FM serve database successfully, since i can fetch out other text data from the database(just not image). Do i still missing any plugins on web server?

Link to comment
Share on other sites

This topic is 4748 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.