This commit is contained in:
friendica
2012-08-05 21:41:58 -07:00
parent 4f64599210
commit c673c70c25
18 changed files with 56 additions and 21 deletions

View File

@@ -894,7 +894,7 @@ function scale_external_images($s, $include_link = true, $scale_replace = false)
$s = htmlspecialchars_decode($s);
$matches = null;
$c = preg_match_all('/\[img\](.*?)\[\/img\]/ism',$s,$matches,PREG_SET_ORDER);
$c = preg_match_all('/\[img.*?\](.*?)\[\/img\]/ism',$s,$matches,PREG_SET_ORDER);
if($c) {
require_once('include/Photo.php');
foreach($matches as $mtch) {
@@ -915,6 +915,12 @@ function scale_external_images($s, $include_link = true, $scale_replace = false)
$scaled = $mtch[1];
$i = fetch_url($scaled);
$cache = get_config('system','itemcache');
if (($cache != '') and is_dir($cache)) {
$cachefile = $cache."/".hash("md5", $scaled);
file_put_contents($cachefile, $i);
}
// guess mimetype from headers or filename
$type = guess_image_type($mtch[1],true);
@@ -940,6 +946,11 @@ function scale_external_images($s, $include_link = true, $scale_replace = false)
}
}
}
// replace the special char encoding
$s = htmlspecialchars($s,ENT_QUOTES,'UTF-8');
return $s;
}