Gitlab CSE Unil

Commit 8cc2c1b8 authored by M. Chardon's avatar M. Chardon
Browse files

correction stamp : creation du repetoire temporaire à la volée si non existant

parent d8821989
......@@ -71,6 +71,12 @@ class utils_stamp {
$outputDirectory = $CFG->dataroot . self::STAMPS_FILEAREA;
$fileName = sprintf("%s%s.png", $outputDirectory, $iconName);
$dirPath = dirname($fileName);
if (!is_dir($dirPath) || !file_exists($dirPath)) {
//try to create the directory
self::mkdirRecursive($dirPath, 0777);
}
//get RGB color
$colorRGB = utils_color::hex2RGB($color);
......@@ -78,6 +84,18 @@ class utils_stamp {
return self::putIconIntoFile($charFAHexaCode, $fileName, $colorRGB, $fontSize);
}
/**
* Create a final directory with its path
*
* @param String $pathname Path to final directory to create
* @param String $mode Linux right
* @return Boolean If directory is created
*/
public static function mkdirRecursive($pathname, $mode) {
is_dir(dirname($pathname)) || mkdir_recursive(dirname($pathname), $mode);
return is_dir($pathname) || @mkdir($pathname, $mode);
}
/**
* Write a chart into a PNG file
*
......
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