Image embedder and spaces in filenames

Swift Mailer is a fantastic library for sending email with php. Discuss this library or ask any questions about it here.

Moderators: Chris Corbyn, General Moderators

Post Reply
afwt
Forum Newbie
Posts: 15
Joined: Fri Sep 21, 2007 2:53 pm

Image embedder and spaces in filenames

Post by afwt »

It looks like this doesn't work. Out of 20 images in my email, only three (the ones with spaces in filenames) were omitted. What preg should I change to make these included too, does anybody know?

Thanks in advance.
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post by John Cartwright »

I'm not sure why it didn't work, but try passing the filename through urlencode() to encode the spaces.
afwt
Forum Newbie
Posts: 15
Joined: Fri Sep 21, 2007 2:53 pm

Post by afwt »

I apologize for not specifying before: I'm using FileEmbedder plugin, I'm not doing anything, I believe the pattern is bad, the one that grabs image URLs... :-(
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

Spaces shouldn't affect it. It's looking for all bytes in the ascii range by default. More likely an incorrect file path would affect it. What does realpath() show? Also is this a remote file (over HTTP/FTP) or a local file on disk?
afwt
Forum Newbie
Posts: 15
Joined: Fri Sep 21, 2007 2:53 pm

Post by afwt »

I apologize for not responding earlier. No need for realpath(), yes, it is a remote file, it is included via URL as specified in my previous response. :-(
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

afwt wrote:yes, it is a remote file
In that case you can't legally have spaces in the filename since URLs should never contain spaces. urlencode() the path, or replace your spaces with "+" or "%20".
Post Reply