Fixed file path

This commit is contained in:
Jade Levesque 2018-04-07 23:09:34 -05:00
parent 7f820c08fc
commit dd8fde650e
2 changed files with 9 additions and 10 deletions

View File

@ -60,7 +60,13 @@ switch ($beaming_permitted)
case 0: case 0:
if (move_uploaded_file($_FILES["fileToUpload"]["tmp_name"],$dest_file)) if (move_uploaded_file($_FILES["fileToUpload"]["tmp_name"],$dest_file))
{ {
// $file_ext = pathinfo($dest_file, PATHINFO_EXTENSION);
// if ($file_ext == "jpg")
// {
// sanitize_image($dest_file);
// }
write_metadata($dest_file, $_POST["file_source"]); write_metadata($dest_file, $_POST["file_source"]);
celebrate($dest_file, $file_beam_item, celebrate($dest_file, $file_beam_item,
$file_beam_win_img, $file_beam_win_alt, true); $file_beam_win_img, $file_beam_win_alt, true);
} }

13
lib.php
View File

@ -96,7 +96,7 @@ function get_cwd($url)
{ {
$parts = count($url_array); $parts = count($url_array);
$url = implode(array_splice($url_array, 1, $parts - 2)); $url = $_SERVER["HTTP_HOST"] . implode(array_splice($url_array, 1, $parts - 2));
return $url; return $url;
} }
@ -106,16 +106,9 @@ function get_cwd($url)
} }
} }
function sanitize_jpg($path) function sanitize_image($path)
{ {
$image = new Imagick($path); exec("mogrify -strip " . $path, $result);
$profiles = $image->getImageProfiles("icc", true);
$image->Imagick::stripImage();
if(!empty($profiles))
$image->profileImage("icc", $profiles['icc']);
} }