From 5c7b40ad0d69f5bcdab34703662c46168a126352 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Victor=20Ni=C8=9Bu?= Date: Thu, 13 Feb 2014 00:30:16 +0200 Subject: [PATCH] Stopped CKEditor screwing with images' alt attribute (quoting hell) --- core/browser.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/core/browser.php b/core/browser.php index 43109df..aa41b37 100644 --- a/core/browser.php +++ b/core/browser.php @@ -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",