function photos_check_path in Album Photos 7.3
Same name and namespace in other branches
- 6.2 photos.module \photos_check_path()
Save photos in custom directory structure.
3 calls to photos_check_path()
- photos_swfu_upload in photos_swfu/
photos_swfu.module - Upload photos with SWFUpload.
- photos_upload_form_submit in inc/
photos.edit.inc - Submit upload form.
- _photos_unzip in ./
photos.module - Unzip.
File
- ./
photos.module, line 1560 - Implementation of photos.module.
Code
function photos_check_path($type = 'default', $file = FALSE, $account = FALSE) {
if (!$account) {
global $user;
$account = $user;
}
$path = array();
switch ($type) {
case 'default':
if (variable_get('photos_path', 'photos')) {
$mm = format_date(REQUEST_TIME, 'custom', "Y|m|d");
$m = explode('|', $mm);
$a = array(
'%uid' => $account->uid,
'%username' => $account->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_default_scheme() . '://' . implode('/', $dirs);
if (!file_prepare_directory($t, FILE_CREATE_DIRECTORY)) {
return FALSE;
}
}
return $t;
}