Skip to content

Commit

Permalink
Stopped CKEditor screwing with images' alt attribute (quoting hell)
Browse files Browse the repository at this point in the history
  • Loading branch information
nightsh committed Feb 12, 2014
1 parent 42c2e74 commit 5c7b40a
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions core/browser.php
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,14 @@ protected function act_upload() {

if ($this->config['read_exif'] == true) {
$exif = exif_read_data($dir.'/'.$name, 'IFD0');

// Hack the quotes, since they will surely destroy everything due to CKEditor's
// evil escape-everything policy (tried with entities, utf-8 chars, everything,
// this shit's very very fucked).
$exif['ImageDescription'] = str_replace('"','`', $exif['ImageDescription']);
$exif['ImageDescription'] = str_replace("'",'`', $exif['ImageDescription']);

// Now that the quotes are gone, safely write the stuff down to the EXIF file
file_put_contents(
str_replace('/uploads/', '/uploads/.thumbs/', $dir)
. "/$name.exif",
Expand Down

0 comments on commit 5c7b40a

Please sign in to comment.