0

I have been getting an errors from my error log of missing images. The reason the are appearing missing is because after the image file extension there is a blank space like this

uploads/images/thumbs/natasha.jpg%20

This 404 error does not occur always, it happens some times.

I have built the project on the Codeigniter php framework.

What should I do to remove the trailing space?

2 Answers2

2

Try to trim and decode it first

$image = trim(urldecode($image));
novalagung
  • 10,905
  • 4
  • 58
  • 82
0

You need to use the trim() function. (http://au1.php.net/manual/en/function.trim.php)

e.g.

$image = " this/is/the/path/to/myimage.jpg ";
// Note the spaces around the string

$image = trim($image);
// $image now equals "thisis/the/path/to/myimage.jpg"
// Note: no spaces
Toby
  • 121
  • 3