diff --git a/ext/danbooru_api/main.php b/ext/danbooru_api/main.php index 0892e3fd..085a7cc1 100644 --- a/ext/danbooru_api/main.php +++ b/ext/danbooru_api/main.php @@ -271,7 +271,7 @@ class DanbooruApi extends Extension } } elseif (isset($_REQUEST['source']) || isset($_REQUEST['post']['source'])) { // A url was provided $source = isset($_REQUEST['source']) ? $_REQUEST['source'] : $_REQUEST['post']['source']; - $file = tempnam("/tmp", "shimmie_transload"); + $file = tempnam(sys_get_temp_dir(), "shimmie_transload"); $ok = transload($source, $file); if (!$ok) { $page->set_code(409); diff --git a/ext/media/main.php b/ext/media/main.php index 0ec336ed..ae68d477 100644 --- a/ext/media/main.php +++ b/ext/media/main.php @@ -364,7 +364,7 @@ class Media extends Extension } $inname = warehouse_path(Image::IMAGE_DIR, $hash); - $tmpname = tempnam("/tmp", "shimmie_ffmpeg_thumb"); + $tmpname = tempnam(sys_get_temp_dir(), "shimmie_ffmpeg_thumb"); $outname = warehouse_path(Image::THUMBNAIL_DIR, $hash); $orig_size = self::video_size($inname); diff --git a/ext/ouroboros_api/main.php b/ext/ouroboros_api/main.php index f0f983bf..ee52555c 100644 --- a/ext/ouroboros_api/main.php +++ b/ext/ouroboros_api/main.php @@ -475,7 +475,7 @@ class OuroborosAPI extends Extension ) !== false ) { // Transload from source - $meta['file'] = tempnam('/tmp', 'shimmie_transload_' . $config->get_string('transload_engine')); + $meta['file'] = tempnam(sys_get_temp_dir(), 'shimmie_transload_' . $config->get_string(UploadConfig::TRANSLOAD_ENGINE)); $meta['filename'] = basename($post->file_url); if (!transload($post->file_url, $meta['file'])) { $this->sendResponse(500, 'Transloading failed'); diff --git a/ext/resize/main.php b/ext/resize/main.php index ea03abe4..7658cc89 100644 --- a/ext/resize/main.php +++ b/ext/resize/main.php @@ -198,7 +198,7 @@ class ResizeImage extends Extension list($new_height, $new_width) = $this->calc_new_size($image_obj, $width, $height); /* Temp storage while we resize */ - $tmp_filename = tempnam("/tmp", 'shimmie_resize'); + $tmp_filename = tempnam(sys_get_temp_dir(), 'shimmie_resize'); if (empty($tmp_filename)) { throw new ImageResizeException("Unable to save temporary image file."); } diff --git a/ext/transcode/main.php b/ext/transcode/main.php index c68d2665..134e18df 100644 --- a/ext/transcode/main.php +++ b/ext/transcode/main.php @@ -308,7 +308,7 @@ class TranscodeImage extends Extension $q = $config->get_int("transcode_quality"); - $tmp_name = tempnam("/tmp", "shimmie_transcode"); + $tmp_name = tempnam(sys_get_temp_dir(), "shimmie_transcode"); $image = imagecreatefromstring(file_get_contents($source_name)); try { @@ -383,7 +383,8 @@ class TranscodeImage extends Extension $bg = "black"; break; } - $tmp_name = tempnam("/tmp", "shimmie_transcode"); + + $tmp_name = tempnam(sys_get_temp_dir(), "shimmie_transcode"); $source_type = ""; switch ($source_format) {