function photos_check_path in Album Photos 6.2
Same name and namespace in other branches
- 7.3 photos.module \photos_check_path()
4 calls to photos_check_path()
- photos_image_crop in ./
photos.module - photos_swfu_upload in photos_swfu/
photos_swfu.module - photos_upload_form_submit in inc/
photos.edit.inc - _photos_unzip in ./
photos.module
File
- ./
photos.module, line 942
Code
function photos_check_path($type = 'default', $file = false, $ac = false) {
if (!$ac) {
$ac = $GLOBALS['user'];
}
$path = array();
switch ($type) {
case 'thumb':
$filename = end(explode('/', $file[0]));
$t = str_replace('/' . $filename, '', $file[0]) . '/thumb_' . $file[1];
if (!file_check_directory($t, FILE_CREATE_DIRECTORY)) {
return false;
}
return $t;
case 'default':
if (variable_get('photos_path', 'photos')) {
$mm = format_date(time(), 'custom', "Y|m|d");
$m = explode('|', $mm);
$a = array(
'%uid' => $ac->uid,
'%username' => $ac->name,
'%Y' => $m[0],
'%m' => $m[1],
'%d' => $m[2],
);
$b = strtr(variable_get('photos_path', 'photos'), $a);
$path = explode('/', $b);
}
else {
$path[] = 'photos';
}
break;
}
$dirs = array();
foreach ($path as $folder) {
$dirs[] = $folder;
$t = file_create_path(file_directory_path() . '/' . implode('/', $dirs));
if (!file_check_directory($t, FILE_CREATE_DIRECTORY)) {
return false;
}
}
return $t;
}