Commit 35cc1c9d authored by Malcolm Blaney's avatar Malcolm Blaney

Added ability to rotate images in the Browser module. Also added

transparency support for png images in both the Browser module and
when resizing images in SimplePie. Special case facebook feed in
Reader module to pull author from content, as it has pretty
consistent markup.
parent b6da5b49
Pipeline #36004861 passed with stage
in 1 minute and 22 seconds
......@@ -34,6 +34,10 @@ class Browser extends Base {
if ($us_action === 'upload') {
return $this->UploadFile();
}
if ($us_action === 'rotate') {
return $this->RotateImage();
}
return ['error' => 'Unknown action.'];
}
public function CanAdd($page) {
......@@ -68,29 +72,35 @@ class Browser extends Base {
'/' . $this->user->name . '/public/';
// Display thumbnails for all files in this user's public folder.
if ($handle = opendir($this->PublicDirectory())) {
while (($file = readdir($handle)) !== false) {
while (($filename = readdir($handle)) !== false) {
// Ignore actual thumbnail files.
if (strpos($file, '_thumb.')) {
if (strpos($filename, '_thumb.')) {
continue;
}
if (preg_match('/^(.+)\.(.+)$/', $file, $matches)) {
if (preg_match('/^(.+)\.(.+)$/', $filename, $matches)) {
$name = $matches[1];
$type = $matches[2];
$src = '';
$thumbnail = '';
$updated = '';
if (in_array(strtolower($type), ['gif', 'jpeg', 'jpg', 'png'])) {
$name .= '_thumb.' . $type;
if (file_exists($this->PublicDirectory($name))) {
$src = '<img title = "' . $file . '" src="' . $html_path .
$name . '">';
if (in_array($name, $_SESSION['browser-rotated'])) {
$updated = '?updated=' . time();
}
$thumbnail = '<img title = "' . $filename . '" ' .
'src="' . $html_path . $name . $updated . '">';
}
else {
$src = '<b title="' . $file . '">no thumbnail</b>';
$thumbnail = '<b title="' . $filename . '">no thumbnail</b>';
}
}
else {
$src = '<b title="' . $file . '">' . $type . '</b>';
$thumbnail = '<b title="' . $filename . '">' . $type . '</b>';
}
$content .= $this->ImageContent($src, $html_path . $file);
$content .=
$this->ImageContent($thumbnail, $html_path . $filename . $updated);
}
}
}
......@@ -165,12 +175,12 @@ class Browser extends Base {
// Private functions below here ////////////////////////////////////////////
private function RemoveFile() {
$regex = '/^([a-z0-9_-]{1,200})\.([a-z0-9]{1,10})$/i';
$regex = '/^([a-z0-9_-]{1,200})\.([a-z0-9]{1,10})/i';
$us_file = basename($_POST['file']);
if (preg_match($regex, $us_file, $matches)) {
$name = $matches[1];
$type = $matches[2];
unlink($this->PublicDirectory($us_file));
unlink($this->PublicDirectory($name . '.' . $type));
if (in_array(strtolower($type), ['gif', 'jpeg', 'jpg', 'png'])) {
unlink($this->PublicDirectory($name . '_thumb.' . $type));
}
......@@ -198,12 +208,12 @@ class Browser extends Base {
$max_file_size . 'M)'];
}
// Replace spaces in the uploaded file name.
$file = preg_replace('/ /', '_', basename($_FILES['upload']['name']));
$filename = preg_replace('/ /', '_', basename($_FILES['upload']['name']));
$regex = '/^([a-z0-9_-]{1,200})\.([a-z0-9]{1,10})$/i';
if (!preg_match($regex, $file, $matches)) {
if (!preg_match($regex, $filename, $matches)) {
return ['error' => 'Filename does not have correct format.'];
}
$path = $this->PublicDirectory($file);
$path = $this->PublicDirectory($filename);
if (file_exists($path)) {
return ['error' => 'A file with that name already exists.'];
}
......@@ -217,13 +227,13 @@ class Browser extends Base {
}
$tmp = $_FILES['upload']['tmp_name'];
if (!move_uploaded_file($tmp, $path)) {
return ['error' => 'File: ' . $file . ' was not uploaded.'];
return ['error' => 'File: ' . $filename . ' was not uploaded.'];
}
$name .= '_thumb.' . $type;
$html_path = $this->user->name === 'admin' ? '/public/' :
'/' . $this->user->name . '/public/';
$src = '';
$thumbnail = '';
if (in_array(strtolower($type), ['gif', 'jpeg', 'jpg', 'png'])) {
list($old_width, $old_height) = getimagesize($path);
......@@ -236,9 +246,9 @@ class Browser extends Base {
$new_width = 300;
$new_height = round($old_height / ($old_width / 300));
}
$thumbnail = $this->PublicDirectory($name);
$thumbnail_path = $this->PublicDirectory($name);
$this->ResizeImage($new_width, $new_height, $old_width, $old_height,
$type, $thumbnail, $path);
$type, $thumbnail_path, $path);
// Also if the original image is greater than 700px in either
// dimension, reduce it.
......@@ -256,18 +266,22 @@ class Browser extends Base {
$this->ResizeImage($new_width, $new_height, $old_width, $old_height,
$type, $path);
}
$src = '<img title="' . $file . '" src="' . $html_path . $name . '">';
$thumbnail =
'<img title="' . $filename . '" src="' . $html_path . $name . '">';
}
else {
$src = '<b title="' . $file . '">' . $type . '</b>';
$thumbnail = '<span title="' . $filename . '">' . $type . '</span>';
}
return ['content' => $this->ImageContent($src, $html_path . $file)];
return ['content' =>
$this->ImageContent($thumbnail, $html_path . $filename)];
}
private function ImageContent($src, $image) {
return '<span class="thumbnail hidden">' . $src .
'<span class="filename hidden">' . $image . '</span><br>' .
private function ImageContent($thumbnail, $filename) {
return '<span class="thumbnail hidden">' . $thumbnail .
'<span class="filename hidden">' . $filename . '</span><br>' .
'<button class="select hidden">select</button>' .
'<button class="rotate-left hidden">rotate left</button>' .
'<button class="rotate-right hidden">rotate right</button>' .
'<button class="remove hidden">remove</button>' .
'</span>';
}
......@@ -291,6 +305,11 @@ class Browser extends Base {
}
$new_image = imagecreatetruecolor($new_width, $new_height);
if ($type === 'png') {
imagealphablending($new_image, false);
imagesavealpha($new_image, true);
}
imagecopyresampled($new_image, $old_image, 0, 0, 0, 0, $new_width,
$new_height, $old_width, $old_height);
if ($type === 'gif') {
......@@ -302,6 +321,92 @@ class Browser extends Base {
else if ($type === 'png') {
imagepng($new_image, $new_path);
}
imagedestroy($old_image);
imagedestroy($new_image);
}
private function RotateImage() {
// Default is left (90 degrees anticlockwise)
$angle = 90;
if ($_POST['direction'] === 'right') $angle = 270;
$file = basename($_POST['file']);
$regex = '/^([a-z0-9_-]{1,200})\.([a-z0-9]{1,10})/i';
if (preg_match($regex, $file, $matches)) {
$name = $matches[1];
$type = $matches[2];
if (!in_array(strtolower($type), ['gif', 'jpeg', 'jpg', 'png'])) {
return ['error' => 'Format not supported.'];
}
$image_path = $this->PublicDirectory($name . '.' . $type);
$thumb_path = $this->PublicDirectory($name . '_thumb.' . $type);
if (!file_exists($image_path)) {
return ['error' => 'Image file not found.'];
}
if (!file_exists($thumb_path)) {
return ['error' => 'Thumbnail file not found.'];
}
if ($type === 'gif') {
$image = imagecreatefromgif($image_path);
$rotate = imagerotate($image, $angle, 0);
imagegif($rotate, $image_path);
imagedestroy($image);
imagedestroy($rotate);
$thumb = imagecreatefromgif($thumb_path);
$rotate = imagerotate($thumb, $angle, 0);
imagegif($rotate, $thumb_path);
imagedestroy($thumb);
imagedestroy($rotate);
}
else if ($type === 'jpg' || $type === 'jpeg') {
$image = imagecreatefromjpeg($image_path);
$rotate = imagerotate($image, $angle, 0);
imagejpeg($rotate, $image_path);
imagedestroy($image);
imagedestroy($rotate);
$thumb = imagecreatefromjpeg($thumb_path);
$rotate = imagerotate($thumb, $angle, 0);
imagejpeg($rotate, $thumb_path);
imagedestroy($thumb);
imagedestroy($rotate);
}
else if ($type === 'png') {
$image = imagecreatefrompng($image_path);
$rotate = imagerotate($image, $angle, 0);
imagealphablending($rotate, false);
imagesavealpha($rotate, true);
imagepng($rotate, $image_path);
imagedestroy($image);
imagedestroy($rotate);
$thumb = imagecreatefrompng($thumb_path);
$rotate = imagerotate($thumb, $angle, 0);
imagealphablending($rotate, false);
imagesavealpha($rotate, true);
imagepng($rotate, $thumb_path);
imagedestroy($thumb);
imagedestroy($rotate);
}
// Return the path to the image, making sure it's not cached, and track
// this image as rotated so that the cache is skipped next time the
// browser module is loaded.
$html_path = $this->user->name === 'admin' ? '/public/' :
'/' . $this->user->name . '/public/';
if (isset($_SESSION['browser-rotated']) &&
!in_array($html_path, $_SESSION['browser-rotated'])) {
$_SESSION['browser-rotated'][] = $name . '_thumb.' . $type;
}
else {
$_SESSION['browser-rotated'] = [$name . '_thumb.' . $type];
}
$thumb_path = $html_path . $name . '_thumb.' . $type . '?update=' .time();
$image_path = $html_path . $name . '.' . $type . '?update=' . time();
return ['src' => $thumb_path, 'filename' => $image_path];
}
return ['error' => 'Filename does not have correct format.'];
}
}
......@@ -1142,7 +1142,7 @@ class Reader extends Base {
}
$content .= '<br><b>' . $count . ' photos</b></p>';
}
else if ($count == 1) {
else if ($count === 1) {
$content .= '<p><img src="' . $photo_list[0] . '"></p>';
}
}
......@@ -1845,10 +1845,10 @@ class Reader extends Base {
if ($check_title === $check_content) {
$us_title = '';
}
else if (strlen($us_title) > 100) {
else if (strlen($us_title) > 140) {
// This assumes that long titles are probably the same as the content,
// but the comparison failed. In this case show a shortened version.
$us_title = substr($us_title, 0, 40) . '...';
$us_title = substr($us_title, 0, 100) . '...';
}
}
......@@ -1882,14 +1882,33 @@ class Reader extends Base {
}
// html isn't escaped for author and categories to support h-card.
$us_author = $purifier->purify(htmlspecialchars_decode($us_author));
// Try parsing author as microformats which will store it in the nickname
// cache.
$mf = Mf2\parse($us_author);
foreach ($mf['items'] as $mf_item) {
$us_author_name = parse_hcard($mf_item, true);
if ($us_author_name !== '') {
$us_author = $us_author_name;
break;
// Special case for items generated by facebook-atom.appspot.com, the
// author is always the first link in the content. Pass it to parse_hcard
// so that it gets stored in the nickname cache.
if (strpos($xml_url, 'https://facebook-atom.appspot.com') === 0) {
$regex = '/<a\s+href="([^"]+)">([^<]+)<\/a>/';
if (preg_match($regex, $us_content, $match)) {
$us_author_url = trim($match[1]);
$us_author_name = trim($match[2]);
$h_card = ['type' => ['h-card'],
'properties' => ['url' => [$us_author_url],
'name' => [$us_author_name]]];
$us_author = parse_hcard($h_card, true);
// Also remove the author from content.
$us_content = preg_replace($regex, '', $us_content, 1);
$content = $mysqli->escape_string($purifier->purify($us_content));
}
}
else {
// Try parsing author as microformats which will store it in the
// nickname cache.
$mf = Mf2\parse($us_author);
foreach ($mf['items'] as $mf_item) {
$us_author_name = parse_hcard($mf_item, true);
if ($us_author_name !== '') {
$us_author = $us_author_name;
break;
}
}
}
$author = $mysqli->escape_string($us_author);
......
......@@ -308,6 +308,11 @@ class Writer extends Base {
'"inline-block"',
'"",".writer-twitter","margin-left","10px"',
'"","#writer-follow","float","right"',
'"","#writer-photo-selected","margin","5px 5px 0 40px"',
'"","#writer-photo-selected","background-color","#eeeeee"',
'"","#writer-photo-selected","border","1px solid #aaaaaa"',
'"","#writer-photo-selected","border-radius","2px"',
'"","#writer-photo-selected img","margin","5px"',
'"","#writer-photo-selected img","height","50px"'];
$this->AddSiteStyle($site_style);
return $this->Dependencies(['post']);
......
......@@ -26,16 +26,20 @@
if(!this.dobrado.browser){dobrado.browser={};}
(function(){'use strict';var callback=false;$(function(){if($('.browser').length===0){return;}
$('.browser').dialog({show:true,width:720,height:500,position:{my:'top',at:'top+50',of:window},title:'Browser',create:dobrado.fixedDialog,close:function(){$('.browser').remove();}});$('#browser-upload-input').val('').change(upload);$('#browser-upload').button({disabled:true}).click(upload);$('#browser-upload-progress').progressbar();$('.thumbnail').show().click(highlight);$('.thumbnail .select').button().click(select);$('.thumbnail .remove').button({icon:'ui-icon-trash',showLabel:false}).click(remove);var filenames=[];$('.browser .filename').each(function(){filenames.push($(this).text());});$('#browser-search').autocomplete({minLength:1,search:dobrado.fixAutoCompleteMemoryLeak,source:filenames,response:filter,close:filterReset});});function remove(){var that=this;$.post('/php/request.php',{request:'browser',action:'remove',file:$(this).siblings('.filename').html(),url:location.href,token:dobrado.token},function(response){if(dobrado.checkResponseError(response,'browser remove')){return;}
$('.browser').dialog({show:true,width:720,height:500,position:{my:'top',at:'top+50',of:window},title:'Browser',create:dobrado.fixedDialog,close:function(){$('.browser').remove();}});$('#browser-upload-input').val('').change(upload);$('#browser-upload').button({disabled:true}).click(upload);$('#browser-upload-progress').progressbar();$('.thumbnail').show().click(highlight);$('.thumbnail .select').button({icon:'ui-icon-plus',showLabel:false}).click(select);$('.thumbnail .rotate-left').button({icon:'ui-icon-arrowreturnthick-1-w',showLabel:false}).click(rotateLeft);$('.thumbnail .rotate-right').button({icon:'ui-icon-arrowreturnthick-1-e',showLabel:false}).click(rotateRight);$('.thumbnail .remove').button({icon:'ui-icon-trash',showLabel:false}).click(remove);var filenames=[];$('.browser .filename').each(function(){filenames.push($(this).text());});$('#browser-search').autocomplete({minLength:1,search:dobrado.fixAutoCompleteMemoryLeak,source:filenames,response:filter,close:filterReset});});function remove(){var that=this;$.post('/php/request.php',{request:'browser',action:'remove',file:$(this).siblings('.filename').html(),url:location.href,token:dobrado.token},function(response){if(dobrado.checkResponseError(response,'browser remove')){return;}
$(that).parent().remove();});}
function rotateLeft(){var that=this;$.post('/php/request.php',{request:'browser',action:'rotate',direction:'left',file:$(this).siblings('.filename').html(),url:location.href,token:dobrado.token},function(response){if(dobrado.checkResponseError(response,'browser rotateLeft')){return;}
var image=JSON.parse(response);$(that).siblings('img').attr('src',image.src);$(that).siblings('.filename').html(image.filename);});}
function rotateRight(){var that=this;$.post('/php/request.php',{request:'browser',action:'rotate',direction:'right',file:$(this).siblings('.filename').html(),url:location.href,token:dobrado.token},function(response){if(dobrado.checkResponseError(response,'browser rotateRight')){return;}
var image=JSON.parse(response);$(that).siblings('img').attr('src',image.src);$(that).siblings('.filename').html(image.filename);});}
function select(){if(/^[0-9]+$/.test(callback)){CKEDITOR.tools.callFunction(callback,$(this).siblings('.filename').html());}
else if(callback&&dobrado[callback]){dobrado[callback].select($(this).siblings('.filename').html());}
callback=false;$('.browser').dialog('close');}
function highlight(){$('.thumbnail .select').hide();$('.thumbnail .remove').hide();$('.thumbnail').removeClass('highlight');$(this).addClass('highlight');$(this).children('.select').show();$(this).children('.remove').show();}
function highlight(){$('.thumbnail .select').hide();$('.thumbnail .rotate-left').hide();$('.thumbnail .rotate-right').hide();$('.thumbnail .remove').hide();$('.thumbnail').removeClass('highlight');$(this).addClass('highlight');$(this).children('.select').show();$(this).children('.rotate-left').show();$(this).children('.rotate-right').show();$(this).children('.remove').show();}
function filter(e,ui){var filenames=[];$.each(ui.content,function(i,data){filenames.push(data.value);});$('.browser .filename').each(function(){if($.inArray($(this).text(),filenames)==-1){$(this).parent().hide();}});}
function filterReset(e,ui){if($('#browser-search').val()===''){$('.browser .filename').parent().show();}}
function upload(){var formData=new FormData();if(!formData){dobrado.log('Your browser doesn\'t support file uploading.','error');return;}
if($('#browser-upload-input').val()===''){$('#browser-upload').button({disabled:true});return;}
$('#browser-upload').button({disabled:false});formData.append('upload',$('#browser-upload-input').get(0).files[0]);formData.append('request','browser');formData.append('action','upload');formData.append('url',location.href);formData.append('token',dobrado.token);$.ajax({url:'/php/request.php',data:formData,contentType:false,processData:false,type:'POST',xhr:function(){var xhr=new XMLHttpRequest();xhr.upload.addEventListener('progress',function(e){if(e.lengthComputable){var percent=e.loaded/e.total*100;if(percent<100){$('#browser-upload-progress').show();$('#browser-upload-progress').progressbar('value',percent);}}});return xhr;},success:function(response){if(dobrado.checkResponseError(response,'browser upload')){return;}
var browser=JSON.parse(response);$('#browser-upload-form').after(browser.content);$('.thumbnail').click(highlight);$('.thumbnail .select:first').button().click(select);$('.thumbnail .remove:first').button({icon:'ui-icon-trash',showLabel:false}).click(remove);$('#browser-upload-input').val('');$('#browser-upload').button({disabled:true});$('#browser-upload-progress').hide();}});return false;}
var browser=JSON.parse(response);$('#browser-upload-form').after(browser.content);$('.thumbnail').click(highlight);$('.thumbnail .select:first').button({icon:'ui-icon-plus',showLabel:false}).click(select);$('.thumbnail .rotate-left:first').button({icon:'ui-icon-arrowreturnthick-1-w',showLabel:false}).click(rotateLeft);$('.thumbnail .rotate-right:first').button({icon:'ui-icon-arrowreturnthick-1-e',showLabel:false}).click(rotateRight);$('.thumbnail .remove:first').button({icon:'ui-icon-trash',showLabel:false}).click(remove);$('#browser-upload-input').val('');$('#browser-upload').button({disabled:true});$('#browser-upload-progress').hide();}});return false;}
dobrado.browser.newModuleCallback=function(selector,context){callback=context;if(/^[0-9]+$/.test(callback)){setTimeout(function(){$(selector).parents('.ui-dialog').css('z-index',11000);},100);}};}());
\ No newline at end of file
......@@ -54,9 +54,16 @@ if (!this.dobrado.browser) {
$('#browser-upload').button({ disabled: true }).click(upload);
$('#browser-upload-progress').progressbar();
$('.thumbnail').show().click(highlight);
$('.thumbnail .select').button().click(select);
$('.thumbnail .remove').button({ icon: 'ui-icon-trash',
showLabel: false }).click(remove);
$('.thumbnail .select').button({
icon: 'ui-icon-plus', showLabel: false }).click(select);
$('.thumbnail .rotate-left').button({
icon: 'ui-icon-arrowreturnthick-1-w',
showLabel: false }).click(rotateLeft);
$('.thumbnail .rotate-right').button({
icon: 'ui-icon-arrowreturnthick-1-e',
showLabel: false }).click(rotateRight);
$('.thumbnail .remove').button({
icon: 'ui-icon-trash', showLabel: false }).click(remove);
var filenames = [];
$('.browser .filename').each(function() {
filenames.push($(this).text());
......@@ -82,6 +89,38 @@ if (!this.dobrado.browser) {
});
}
function rotateLeft() {
var that = this;
$.post('/php/request.php',
{ request: 'browser', action: 'rotate', direction: 'left',
file: $(this).siblings('.filename').html(),
url: location.href, token: dobrado.token },
function(response) {
if (dobrado.checkResponseError(response, 'browser rotateLeft')) {
return;
}
var image = JSON.parse(response);
$(that).siblings('img').attr('src', image.src);
$(that).siblings('.filename').html(image.filename);
});
}
function rotateRight() {
var that = this;
$.post('/php/request.php',
{ request: 'browser', action: 'rotate', direction: 'right',
file: $(this).siblings('.filename').html(),
url: location.href, token: dobrado.token },
function(response) {
if (dobrado.checkResponseError(response, 'browser rotateRight')) {
return;
}
var image = JSON.parse(response);
$(that).siblings('img').attr('src', image.src);
$(that).siblings('.filename').html(image.filename);
});
}
function select() {
// ckeditor uses numeric callback values.
if (/^[0-9]+$/.test(callback)) {
......@@ -98,10 +137,14 @@ if (!this.dobrado.browser) {
function highlight() {
// Hide options for other thumbnails.
$('.thumbnail .select').hide();
$('.thumbnail .rotate-left').hide();
$('.thumbnail .rotate-right').hide();
$('.thumbnail .remove').hide();
$('.thumbnail').removeClass('highlight');
$(this).addClass('highlight');
$(this).children('.select').show();
$(this).children('.rotate-left').show();
$(this).children('.rotate-right').show();
$(this).children('.remove').show();
}
......@@ -166,7 +209,18 @@ if (!this.dobrado.browser) {
var browser = JSON.parse(response);
$('#browser-upload-form').after(browser.content);
$('.thumbnail').click(highlight);
$('.thumbnail .select:first').button().click(select);
$('.thumbnail .select:first').button({
icon: 'ui-icon-plus',
showLabel: false
}).click(select);
$('.thumbnail .rotate-left:first').button({
icon: 'ui-icon-arrowreturnthick-1-w',
showLabel: false
}).click(rotateLeft);
$('.thumbnail .rotate-right:first').button({
icon: 'ui-icon-arrowreturnthick-1-e',
showLabel: false
}).click(rotateRight);
$('.thumbnail .remove:first').button({
icon: 'ui-icon-trash',
showLabel: false
......
......@@ -49,8 +49,7 @@ importList=JSON.parse(response);importCount=0;if(importList.length!==0){var text
return false;}
function newFeedEvents(){$('.reader-actions a').click(readerAction);$('.reader-content .read-more').click(function(){$(this).parent().hide().siblings('.real-content').show();return false;});$('.reader-content .show-group').click(function(){$(this).siblings('.reader-item').show();$(this).hide();return false;});dobrado.indieConfig();}
function readerAction(){var content='';var sendTo='';var item=$(this).parents('.reader-item');var permalink=item.find('.permalink').attr('href');if(!dobrado.editor){dobrado.writer.showEditor();}
if(item.hasClass('facebook-atom-appspot-com')){sendTo='facebook';}
else if(item.hasClass('twitter-atom-appspot-com')){sendTo='twitter';}
if(item.hasClass('twitter-atom-appspot-com')){sendTo='twitter';}
if($(this).hasClass('like')){content='<a href="'+permalink+'">'+permalink+'</a>';if(dobrado.editor){dobrado.editor.setData(content);}
else{$('#writer-content').val(content);}
dobrado.writer.action('like',permalink,sendTo);}
......
......@@ -261,10 +261,7 @@ if (!this.dobrado.reader) {
if (!dobrado.editor) {
dobrado.writer.showEditor();
}
if (item.hasClass('facebook-atom-appspot-com')) {
sendTo = 'facebook';
}
else if (item.hasClass('twitter-atom-appspot-com')) {
if (item.hasClass('twitter-atom-appspot-com')) {
sendTo = 'twitter';
}
if ($(this).hasClass('like')) {
......
......@@ -668,7 +668,13 @@ class SimplePie_Sanitize
else if ($type === 'png') {
$old_image = imagecreatefrompng($path);
}
$new_image = imagecreatetruecolor($new_width, $new_height);
if ($type === 'png') {
imagealphablending($new_image, false);
imagesavealpha($new_image, true);
}
imagecopyresampled($new_image, $old_image, 0, 0, 0, 0, $new_width,
$new_height, $old_width, $old_height);
if ($type === 'gif') {
......@@ -680,6 +686,8 @@ class SimplePie_Sanitize
else if ($type === 'png') {
imagepng($new_image, $path);
}
imagedestroy($old_image);
imagedestroy($new_image);
return file_get_contents($path);
}
......
......@@ -323,7 +323,7 @@ class Control extends Base {
'"","#copy-input","width","150px"',
'"",".control .username","float","right"',
'"",".control .username","font-family","Helvetica"',
'"",".control .username","padding","6px"',
'"",".control .username","margin","6px 10px"',
'"' . $media . '",".control .username","display","none"',
'"",".control .info","position","absolute"',
'"",".control .info","width","18em"',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment