AnsweredAssumed Answered

CWP/PHP Container Images encoding issue

Question asked by fmdataweb on Jul 7, 2014
Latest reply on Jul 9, 2014 by user19752

I'm using FileMaker Server 12 with Custom Web Publishing/FileMaker PHP API to publish a directory which is working well.

 

I've come across a small issue related to the displaying of images which I wanted to see could be resolved with PHP first before I ask the client to rename/reinsert a batch of files. They have inserted a series of photots into container fields, most of which are displaying perfectly on the web, however a number of them are not (showing a ? mark where the image should appear). On closer inspection these files have names like this:

 

Front Photo - + details.jpg

 

There's obviously some issue with encoding going on with the file name and the + character I assume. Here's the php line that fetches the image for displaying:

 

$imagelink = '<IMG width="615" height="396" src="containerBridge.php?path='.urlencode($record->getField('heroPhoto')).'"/>' ;

 

I'm using the PHP urnencode function which I thought would take care of this - it does for files that are named with just spaces like this:

 

Front Photo details.jpg

 

but not for:

 

Front Photo - + details.jpg

 

Anyone know if there's a way to get this working with PHP changes to avoid having to rename/reupload a batch of photos again?

 

thanks,

Steve

Outcomes