Deltacms/core/vendor/screenshot/screenshot.php

24 lines
721 B
PHP
Raw Normal View History

2022-01-31 09:10:49 +01:00
<?php
if (isset($_POST['image'])) {
$data = $_POST['image'] ;
2022-05-30 09:05:11 +02:00
$data = str_replace(' ','+',$data);
2022-09-11 09:42:42 +02:00
$data = str_replace('data:image/jpeg;base64,', '', $data);
2022-01-31 09:10:49 +01:00
$img = base64_decode($data);
// Effacer l'image et la miniature jpg
2022-05-30 09:05:11 +02:00
if (file_exists('../../../site/file/thumb/screenshot.jpg')) {
chmod('../../../site/file/thumb/screenshot.jpg', 0777);
unlink ('../../../site/file/thumb/screenshot.jpg');
2022-01-31 09:10:49 +01:00
}
2022-05-30 09:05:11 +02:00
if (file_exists('../../../site/file/source/screenshot.jpg')) {
chmod('../../../site/file/source/screenshot.jpg', 0777);
unlink ('../../../site/file/source/screenshot.jpg');
2022-01-31 09:10:49 +01:00
}
2022-09-11 09:42:42 +02:00
file_put_contents('../../../site/file/source/screenshot.jpg',$img) ;
2022-05-30 09:05:11 +02:00
2022-01-31 09:10:49 +01:00
}
?>