Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions wwwroot/notgallery.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ function the($Thing)
$Path = pathinfo($Thing);
$Extension = $Path['extension'];

if(preg_match('{jpe?g|gif|png}i', $Extension))
if(preg_match('{jpe?g|gif|png|webp}i', $Extension))
return 'Image';
}

Expand Down Expand Up @@ -62,9 +62,11 @@ function ResizeImage($Filename, $Thumbnail, $Size)
case "image/jpeg":
$Image = @ImageCreateFromJpeg($Filename);
break;
case "image/webp":
$Image = @ImageCreateFromWebp($Filename);
}

if($ImageData[2] == IMAGETYPE_GIF or $ImageData[2] == IMAGETYPE_PNG)
if($ImageData[2] == IMAGETYPE_GIF or $ImageData[2] == IMAGETYPE_PNG or $ImageData[2] == IMAGETYPE_WEBP)
{
$TransIndex = imagecolortransparent($Image);

Expand All @@ -85,7 +87,7 @@ function ResizeImage($Filename, $Thumbnail, $Size)

}
// Always make a transparent background color for PNGs that don't have one allocated already
elseif ($ImageData[2] == IMAGETYPE_PNG)
elseif ($ImageData[2] == IMAGETYPE_PNG or $ImageData[2] == IMAGETYPE_WEBP)
{

// Turn off transparency blending (temporarily)
Expand All @@ -111,6 +113,9 @@ function ResizeImage($Filename, $Thumbnail, $Size)
case "image/png":
@ImagePng($NewImage, $Thumbnail);
break;
case "image/webp":
@ImageWebp($NewImage, $Thumbnail);
break;
case "image/jpeg":
@ImageJpeg($NewImage, $Thumbnail);
break;
Expand Down
8 changes: 7 additions & 1 deletion wwwroot/src/markup/edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,20 +108,26 @@ function edit_replacements($tag, $content)
case "image/png":
$Extension = "png";
break;
case "image/webp":
$Extension = "webp";
break;
case "video/webm":
$Extension = "webm";
break;
case "video/mp4":
$Extension = "mp4";
break;
case "video/quicktime";
$Extension = "mov";
break;
case "video/ogg":
$Extension = "ogv";
break;
case "image/svg+xml":
$Extension = "svg";
break;
default:
return "$Mime: Unsupported format! Please use: jpg, gif, png, webm, gifv, mp4, or ogv";
return "$Mime: Unsupported format! Please use: jpg, gif, png, webp, webm, gifv, mp4, mov, or ogv";
}

while(file_exists("upload/$Filename.$Extension"))
Expand Down
2 changes: 1 addition & 1 deletion wwwroot/src/markup/view.php
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ function view_replacements($tag, $content)
$path = pathinfo($Link);

// If a video extension was used
if(preg_match('/^(webm|mp4|ogv)$/i', $path['extension']))
if(preg_match('/^(webm|mp4|ogv|mov)$/i', $path['extension']))
{
// Output a special html5 player that behaves like a gif
$options = array
Expand Down
7 changes: 7 additions & 0 deletions wwwroot/upload.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ function uuid($prefix = '')
else
{
$Mime = mime_content_type($Image['tmp_name']);
error_log($Mime);
switch($Mime){
case "image/jpg":
$Extension = "jpg";
Expand All @@ -39,6 +40,9 @@ function uuid($prefix = '')
case "image/png":
$Extension = "png";
break;
case "image/webp":
$Extension = "webp";
break;
case "audio/mpeg":
case "audio/mp3":
$Extension = "mp3";
Expand All @@ -50,6 +54,9 @@ function uuid($prefix = '')
case "video/mp4":
$Extension = "mp4";
break;
case "video/quicktime":
$Extension = "mov";
break;
case "audio/midi":
case "audio/xmidi":
$Extension = "mid";
Expand Down