Re: Displaying image paths with spaces
| From: | Ashley Sheridan | Date: | Mon, 07 Sep 2009 08:01:12 +0000 |
| Subject: | Re: Displaying image paths with spaces | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-297751@lists.php.net to get a copy of this message | ||
On Sun, 2009-09-06 at 23:40 -0500, Skip Evans wrote:
> Hey all,
>
> I have a CMS system that uses the FCKeditor to allow users to
> create directories in which to store images. FCK allows users
> to create directories with spaces in them, and it's pretty
> deep in the JavaScript code so modifying that is not a simple
> option, so at this point I'm trying to work from the
> assumption that the users will continue to be allowed to
> create directory names with spaces.
>
> All that said, the CMS outputs data in two ways. I'll start
> with the second method because it works and then move on to
> the problem.
>
> What the user has created in the FCKeditor is a path to an
> image that appears like this:
>
> src="/clients/client_118/images//Event%20images/Show%20ads/catspaw1compressed.jpg"
>
> Notice the '%20' codes for the spaces in the directory names
> like 'Event images' and 'Show ads'.
>
> The first way the code is displayed is with an AJAX call. It's
> read on the PHP side, echo'd back out to the JavaScript code
> and inserted into an ID with an innerHTML assignment. This
> method works.
>
> The first way the code is loaded is pure PHP. It's read from
> the database just as it appears above and then echo'd back to
> the browser. However, in the browser it appears like this:
>
> /clients/client_118/images//Event\ images/Show\
> ads/catspaw1compressed.jpg
>
> And of course the browser can't display the image with those
> '\ ' combinations.
>
> So my task is to get it to display the image properly on the
> pure PHP side the same way it does via the AJAX call.
>
> I should also say that the code the image path resides in
> contains a text, etc, so it's a block of content, containing
> both text and image paths.
>
> Is there a way to read and echo this on the PHP side and
> preserve a properly displayable path like the AJAX call, but
> that also won't interfere with the rest of the HTML and text
> code contained within the block of content?
>
> I'm stumped on this one, so any help would be greatly,
> wonderfully, blissfully even....... appreciated.
>
> Thanks,
> Skip
> --
> ====================================
> Skip Evans
> Big Sky Penguin, LLC
> 503 S Baldwin St, #1
> Madison WI 53703
> 608.250.2720
> http://bigskypenguin.com
> ------------------------------------
> Those of you who believe in
> telekinesis, raise my hand.
> -- Kurt Vonnegut
>
How are you outputting those URLs? PHP won't just automatically converty
'%20' to a '\ '.
What is the raw URL format you're getting from FCKEditor?
Thanks,
Ash
http://www.ashleysheridan.co.uk