diff options
| -rw-r--r-- | LibertyAttachable.php | 2 | ||||
| -rw-r--r-- | liberty_lib.php | 22 | ||||
| -rw-r--r-- | plugins/mime.audio.php | 12 | ||||
| -rw-r--r-- | plugins/mime.default.php | 16 | ||||
| -rw-r--r-- | plugins/mime.flash.php | 2 | ||||
| -rw-r--r-- | plugins/mime.image.php | 9 | ||||
| -rw-r--r-- | plugins/mime.pdf.php | 14 | ||||
| -rw-r--r-- | plugins/mime.video.php | 44 | ||||
| -rw-r--r-- | plugins/processor.gd.php | 2 | ||||
| -rw-r--r-- | plugins/processor.imagick.php | 4 | ||||
| -rw-r--r-- | plugins/processor.magickwand.php | 4 | ||||
| -rw-r--r-- | plugins/storage.bitfile.php | 4 |
12 files changed, 68 insertions, 67 deletions
diff --git a/LibertyAttachable.php b/LibertyAttachable.php index 653d1ac..418e990 100644 --- a/LibertyAttachable.php +++ b/LibertyAttachable.php @@ -156,7 +156,7 @@ class LibertyAttachable extends LibertyContent { $ext = substr( $storeRow['upload']['name'], strrpos( $storeRow['upload']['name'], '.' ) + 1 ); $storeRow['upload']['type'] = $gBitSystem->lookupMimeType( $ext ); } - $storeRow['upload']['dest_path'] = $this->getStorageBranch( $storeRow['attachment_id'], $storeRow['user_id'], $this->getStorageSubDirName() ); + $storeRow['upload']['dest_branch'] = $this->getStorageBranch( $storeRow['attachment_id'], $storeRow['user_id'], $this->getStorageSubDirName() ); if (!empty( $pParamHash['thumbnail_sizes'] ) ) { $storeRow['upload']['thumbnail_sizes'] = $pParamHash['thumbnail_sizes']; } diff --git a/liberty_lib.php b/liberty_lib.php index 08b3b81..a1be0bc 100644 --- a/liberty_lib.php +++ b/liberty_lib.php @@ -422,7 +422,7 @@ function liberty_content_edit( &$pObject ) { * @param array $pFileHash Data require to process the files * @param array $pFileHash['upload']['name'] (required) Name of the uploaded file * @param array $pFileHash['upload']['type'] (required) Mime type of the file uploaded - * @param array $pFileHash['upload']['dest_path'] (required) Relative path where you want to store the file (trailing slash required) + * @param array $pFileHash['upload']['dest_branch'] (required) Relative path where you want to store the file (trailing slash required) * @param array $pFileHash['upload']['source_file'] (required) Absolute path to file including file name * @param boolean $pFileHash['upload']['thumbnail'] (optional) Set to FALSE if you don't want to generate thumbnails * @param array $pFileHash['upload']['thumbnail_sizes'] (optional) Decide what sizes thumbnails you want to create: icon, avatar, small, medium, large @@ -574,7 +574,7 @@ function liberty_process_generic( &$pFileHash, $pMoveFile = TRUE ) { if( !empty( $pFileHash['dest_file'] ) ) { $destFile = $pFileHash['dest_file']; } else { - $destFile = STORAGE_PKG_PATH.$pFileHash['dest_path'].$pFileHash['name'];; + $destFile = STORAGE_PKG_PATH.$pFileHash['dest_branch'].$pFileHash['name'];; if ( is_windows() ) { $destFile = str_replace( '//', '\\', str_replace( "\\", '\\', $destFile ) ); } @@ -637,14 +637,14 @@ function liberty_process_image( &$pFileHash, $pMoveFile = TRUE ) { /** * liberty_clear_thumbnails will clear all thummbnails found in a given directory * - * @param array $pFileHash['dest_path'] should contain the path to the dir where we should remove thumbnails + * @param array $pFileHash['dest_branch'] should contain the path to the dir where we should remove thumbnails * @access public * @return TRUE on success, FALSE on failure */ function liberty_clear_thumbnails( &$pFileHash ) { - if( !empty( $pFileHash['dest_path'] )) { + if( !empty( $pFileHash['dest_branch'] )) { $thumbHash = array( - 'source_file' => $pFileHash['dest_path'], + 'source_file' => $pFileHash['dest_branch'], 'mime_image' => FALSE, ); @@ -725,7 +725,7 @@ function liberty_generate_thumbnails( &$pFileHash ) { $destExt = '.jpg'; } - $initialDestPath = $pFileHash['dest_path']; + $initialDestPath = $pFileHash['dest_branch']; foreach( $pFileHash['thumbnail_sizes'] as $thumbSize ) { if( isset( $gThumbSizes[$thumbSize] )) { $pFileHash['dest_base_name'] = $thumbSize; @@ -737,14 +737,14 @@ function liberty_generate_thumbnails( &$pFileHash ) { unset( $pFileHash['max_width'] ); } - // reset dest_path for created thumbs + // reset dest_branch for created thumbs if( !empty( $pFileHash['thumb_path'] ) ) { $pFileHash['dest_file'] = $pFileHash['thumb_path'].$pFileHash['name']; } else { // create a subdirectory for the thumbs - $pFileHash['dest_path'] = $initialDestPath.'thumbs/'; - if( !is_dir( STORAGE_PKG_PATH.$pFileHash['dest_path'] )) { - mkdir( STORAGE_PKG_PATH.$pFileHash['dest_path'] ); + $pFileHash['dest_branch'] = $initialDestPath.'thumbs/'; + if( !is_dir( STORAGE_PKG_PATH.$pFileHash['dest_branch'] )) { + mkdir( STORAGE_PKG_PATH.$pFileHash['dest_branch'] ); } } @@ -764,7 +764,7 @@ function liberty_generate_thumbnails( &$pFileHash ) { } // to keep everything in bitweaver working smoothly, we need to remove the thumbs/ subdir again - $pFileHash['dest_path'] = $initialDestPath; + $pFileHash['dest_branch'] = $initialDestPath; return $ret; } diff --git a/plugins/mime.audio.php b/plugins/mime.audio.php index fecf2b2..4b23b2e 100644 --- a/plugins/mime.audio.php +++ b/plugins/mime.audio.php @@ -118,7 +118,7 @@ function mime_audio_update( &$pStoreRow, $pParams = NULL ) { // if there was no upload we'll process the file parameters if( empty( $pStoreRow['upload'] ) && !empty( $pParams['meta'] )) { // update our local version of the file - $file = STORAGE_PKG_PATH.$pStoreRow['storage_path']; + $file = STORAGE_PKG_PATH.$pStoreRow['dest_branch']; if( is_file( dirname( $file ).'/bitverted.mp3' )) { $verted = dirname( $file ).'/bitverted.mp3'; } elseif( is_file( dirname( $file ).'/bitverted.m4a' )) { @@ -189,14 +189,14 @@ function mime_audio_converter( &$pParamHash ) { $ret = FALSE; $log = array(); - $source = STORAGE_PKG_PATH.$pParamHash['upload']['dest_path'].$pParamHash['upload']['name']; - $dest_path = dirname( $source ); + $source = STORAGE_PKG_PATH.$pParamHash['upload']['dest_branch'].$pParamHash['upload']['name']; + $destPath = dirname( $source ); if( @BitBase::verifyId( $pParamHash['attachment_id'] )) { $pattern = "#.*\.(mp3|m4a)$#i"; if( !$gBitSystem->isFeatureActive( 'mime_audio_force_encode' ) && preg_match( $pattern, $pParamHash['upload']['name'] )) { // make a copy of the original maintaining the original extension - $dest_file = $dest_path.'/bitverted.'.preg_replace( $pattern, "$1", strtolower( $pParamHash['upload']['name'] )); + $dest_file = $destPath.'/bitverted.'.preg_replace( $pattern, "$1", strtolower( $pParamHash['upload']['name'] )); if( !is_file( $dest_file ) && !link( $source, $dest_file )) { copy( $source, $dest_file ); } @@ -208,7 +208,7 @@ function mime_audio_converter( &$pParamHash ) { // also, using mplayer is a 2 step process: decoding and encoding // if we convert audio, we always make an mp3 - $dest_file = $dest_path.'/bitverted.mp3'; + $dest_file = $destPath.'/bitverted.mp3'; if( !( $ret = mime_audio_converter_ffmpeg( $pParamHash, $source, $dest_file ))) { // fall back to using slower mplayer / lame combo $ret = mime_audio_converter_mplayer_lame( $pParamHash, $source, $dest_file ); @@ -262,7 +262,7 @@ function mime_audio_converter( &$pParamHash ) { $fileHash['type'] = $image['mime']; $fileHash['source_file'] = $tmpfile; - $fileHash['dest_path'] = $pParamHash['upload']['dest_path']; + $fileHash['dest_branch'] = $pParamHash['upload']['dest_branch']; liberty_generate_thumbnails( $fileHash ); // remove temp file diff --git a/plugins/mime.default.php b/plugins/mime.default.php index d186188..b836b00 100644 --- a/plugins/mime.default.php +++ b/plugins/mime.default.php @@ -111,8 +111,8 @@ if( !function_exists( 'mime_default_verify' )) { $pStoreRow['upload']['source_file'] = $pStoreRow['upload']['tmp_name']; // Store all uploaded files in the users storage area - if( empty( $pStoreRow['upload']['dest_path'] )) { - $pStoreRow['upload']['dest_path'] = liberty_mime_get_storage_branch( array( 'sub_dir'=>$pStoreRow['attachment_id'], 'user_id'=>$pStoreRow['user_id'], 'package'=>liberty_mime_get_storage_sub_dir_name( $pStoreRow['upload'] ) ) ); + if( empty( $pStoreRow['upload']['dest_branch'] )) { + $pStoreRow['upload']['dest_branch'] = liberty_mime_get_storage_branch( array( 'sub_dir'=>$pStoreRow['attachment_id'], 'user_id'=>$pStoreRow['user_id'], 'package'=>liberty_mime_get_storage_sub_dir_name( $pStoreRow['upload'] ) ) ); } $ret = TRUE; @@ -138,13 +138,13 @@ if( !function_exists( 'mime_default_update' )) { // this will reset the uploaded file if( BitBase::verifyId( $pStoreRow['attachment_id'] ) && !empty( $pStoreRow['upload'] )) { // Store all uploaded files in the users storage area - if( empty( $pStoreRow['dest_path'] )) { - $pStoreRow['dest_path'] = liberty_mime_get_storage_branch( array( 'sub_dir'=>$pStoreRow['attachment_id'], 'user_id'=>$pStoreRow['user_id'], 'package'=>liberty_mime_get_storage_sub_dir_name( $pStoreRow['upload'] ) ) ); + if( empty( $pStoreRow['dest_branch'] )) { + $pStoreRow['dest_branch'] = liberty_mime_get_storage_branch( array( 'sub_dir'=>$pStoreRow['attachment_id'], 'user_id'=>$pStoreRow['user_id'], 'package'=>liberty_mime_get_storage_sub_dir_name( $pStoreRow['upload'] ) ) ); } - if( !empty( $pStoreRow['dest_path'] ) && !empty( $pStoreRow['file_name'] ) ) { + if( !empty( $pStoreRow['dest_branch'] ) && !empty( $pStoreRow['file_name'] ) ) { // First we remove the old file - $path = STORAGE_PKG_PATH.$pStoreRow['dest_path']; + $path = STORAGE_PKG_PATH.$pStoreRow['dest_branch']; $file = $path.$pStoreRow['file_name']; if(( $nuke = LibertyMime::validateStoragePath( $path )) && is_dir( $nuke )) { if( !empty( $pStoreRow['unlink_dir'] )) { @@ -156,7 +156,7 @@ if( !function_exists( 'mime_default_update' )) { } // make sure we store the new file in the same place as before - $pStoreRow['upload']['dest_path'] = $pStoreRow['dest_path']; + $pStoreRow['upload']['dest_branch'] = $pStoreRow['dest_branch']; // if we can create new thumbnails for this file, we remove the old ones first $canThumbFunc = liberty_get_function( 'can_thumbnail' ); @@ -273,7 +273,7 @@ if( !function_exists( 'mime_default_load' )) { $ret['display_url'] = LIBERTY_PKG_URL."view_file.php?attachment_id=".$row['attachment_id']; } - // legacy table data was named storage_path and included a partial path. strip out any path just in case + // legacy table data was named storage path and included a partial path. strip out any path just in case $ret['file_name'] = basename( $row['file_name'] ); $ret['preferences'] = $pPrefs; diff --git a/plugins/mime.flash.php b/plugins/mime.flash.php index a21b778..d1f0bbd 100644 --- a/plugins/mime.flash.php +++ b/plugins/mime.flash.php @@ -101,7 +101,7 @@ function mime_flash_store_preferences( &$pFileHash ) { $ret = FALSE; if( @BitBase::verifyId( $pFileHash['attachment_id'] )) { - list( $pFileHash['preferences']['width'], $pFileHash['preferences']['height'], $type, $attr) = getimagesize( STORAGE_PKG_PATH.$pFileHash['upload']['dest_path'].$pFileHash['upload']['name'] ); + list( $pFileHash['preferences']['width'], $pFileHash['preferences']['height'], $type, $attr) = getimagesize( STORAGE_PKG_PATH.$pFileHash['upload']['dest_branch'].$pFileHash['upload']['name'] ); // store width of video if( !empty( $pFileHash['preferences']['width'] )) { diff --git a/plugins/mime.image.php b/plugins/mime.image.php index 42e17e9..0daecaf 100644 --- a/plugins/mime.image.php +++ b/plugins/mime.image.php @@ -161,7 +161,7 @@ function mime_image_load( &$pFileHash, &$pPrefs, $pParams = NULL ) { } // check for panorama image - if( is_file( STORAGE_PKG_PATH.dirname( $ret['storage_path'] )."/thumbs/panorama.jpg" )) { + if( is_file( dirname( $ret['source_file'] )."/thumbs/panorama.jpg" )) { // if the panorama doesn't have 180⁰ vertical field of view we will restrict up / down movement if(( $ret['pano'] = LibertyMime::getMetaData( $ret['attachment_id'], "PANO" )) && !empty( $ret['pano']['aspect'] )) { // calculation based on logarythmic regression curve @@ -172,7 +172,7 @@ function mime_image_load( &$pFileHash, &$pPrefs, $pParams = NULL ) { $ret['pano']['pa'] = 0; } } - $ret['thumbnail_url']['panorama'] = storage_path_to_url( dirname( $ret['storage_path'] )."/thumbs/panorama.jpg" ); + $ret['thumbnail_url']['panorama'] = storage_path_to_url( dirname( $ret['source_file'] )."/thumbs/panorama.jpg" ); } } return $ret; @@ -303,7 +303,7 @@ function mime_image_convert_exifgps( $pParams ) { function mime_image_create_panorama( &$pStoreRow ) { global $gBitSystem, $gThumbSizes; // we know the panorama image will be a jpeg, so we don't need the canThumbFunc check here - if(( $panoramaFunc = liberty_get_function( 'panorama' )) && !empty( $pStoreRow['storage_path'] ) && !empty( $pStoreRow['source_file'] ) && is_file( $pStoreRow['source_file'] )) { + if(( $panoramaFunc = liberty_get_function( 'panorama' )) && !empty( $pStoreRow['source_file'] ) && is_file( $pStoreRow['source_file'] )) { // the panorama has to be a jpg $gBitSystem->setConfig( 'liberty_thumbnail_format', 'jpg' ); $width = $gBitSystem->getConfig( 'mime_image_panorama_width', 3000 ); @@ -316,7 +316,8 @@ function mime_image_create_panorama( &$pStoreRow ) { $genHash = array( 'attachment_id' => $pStoreRow['attachment_id'], - 'dest_path' => dirname( $pStoreRow['storage_path'] )."/", + 'dest_branch' => liberty_mime_get_storage_branch( array( 'sub_dir' => $pStoreRow['attachment_id'], 'user_id' =>$pStoreRow['user_id'], 'package' => liberty_mime_get_storage_sub_dir_name( $pStoreRow ) ) ), + 'file_name' => dirname( $pStoreRow['file_name'] )."/", 'source_file' => $pStoreRow['source_file'], 'type' => $pStoreRow['mime_type'], 'thumbnail_sizes' => array( 'panorama' ), diff --git a/plugins/mime.pdf.php b/plugins/mime.pdf.php index 8bef342..ce7ffdc 100644 --- a/plugins/mime.pdf.php +++ b/plugins/mime.pdf.php @@ -110,11 +110,11 @@ function mime_pdf_load( &$pFileHash, &$pPrefs, $pParams = NULL ) { global $gBitSystem; // don't load a mime image if we don't have an image for this file if( $ret = mime_default_load( $pFileHash, $pPrefs, $pParams )) { - if( !empty( $ret['storage_path'] )) { - $source_path = STORAGE_PKG_PATH.dirname( $ret['storage_path'] ).'/'; + if( !empty( $ret['source_file'] )) { + $source_path = STORAGE_PKG_PATH.dirname( $ret['source_file'] ).'/'; // if the swf file exists, we pass it back that it can be viewed. if( is_file( $source_path.'pdf.swf' )) { - $ret['media_url'] = storage_path_to_url( dirname( $ret['storage_path'] ).'/pdf.swf' ); + $ret['media_url'] = storage_path_to_url( dirname( $ret['source_file'] ).'/pdf.swf' ); } } } @@ -137,11 +137,11 @@ function mime_pdf_convert_pdf2swf( $pFileHash ) { $swfcombine = trim( $gBitSystem->getConfig( 'swfcombine_path', shell_exec( 'which swfcombine' ))); if( is_executable( $pdf2swf ) && is_executable( $swfcombine )) { - $source = STORAGE_PKG_PATH.$pFileHash['upload']['dest_path'].$pFileHash['upload']['name']; - $dest_path = dirname( $source ); + $source = STORAGE_PKG_PATH.$pFileHash['upload']['dest_branch'].$pFileHash['upload']['name']; + $destPath = dirname( $source ); - $tmp_file = "$dest_path/tmp.swf"; - $swf_file = "$dest_path/pdf.swf"; + $tmp_file = "$destPath/tmp.swf"; + $swf_file = "$destPath/pdf.swf"; $pdfviewer = UTIL_PKG_PATH."javascript/pdfviewer/fdviewer.swf"; $swfloader = UTIL_PKG_PATH."javascript/pdfviewer/loader.swf"; diff --git a/plugins/mime.video.php b/plugins/mime.video.php index 4675eee..ba419b6 100644 --- a/plugins/mime.video.php +++ b/plugins/mime.video.php @@ -150,16 +150,16 @@ function mime_video_load( $pFileHash, &$pPrefs, $pParams = NULL ) { global $gLibertySystem, $gBitThemes; if( $ret = mime_default_load( $pFileHash, $pParams )) { // check for status of conversion - if( !empty( $ret['storage_path'] )) { - $source_path = STORAGE_PKG_PATH.dirname( $ret['storage_path'] ).'/'; + if( !empty( $ret['source_file'] )) { + $source_path = STORAGE_PKG_PATH.dirname( $ret['source_file'] ).'/'; if( is_file( $source_path.'error' )) { $ret['status']['error'] = TRUE; } elseif( is_file( $source_path.'processing' )) { $ret['status']['processing'] = TRUE; } elseif( is_file( $source_path.'flick.flv' )) { - $ret['media_url'] = storage_path_to_url( dirname( $ret['storage_path'] ).'/flick.flv' ); + $ret['media_url'] = storage_path_to_url( dirname( $ret['source_file'] ).'/flick.flv' ); } elseif( is_file( $source_path.'flick.mp4' )) { - $ret['media_url'] = storage_path_to_url( dirname( $ret['storage_path'] ).'/flick.mp4' ); + $ret['media_url'] = storage_path_to_url( dirname( $ret['source_file'] ).'/flick.mp4' ); } } @@ -233,8 +233,8 @@ function mime_video_converter( &$pParamHash, $pOnlyGetParameters = FALSE ) { } else { // this is the codec we'll use - currently this might be: flv, h264, h264-2pass $codec = $gBitSystem->getConfig( "mime_video_video_codec", "flv" ); - $source = STORAGE_PKG_PATH.$pParamHash['upload']['dest_path'].$pParamHash['upload']['name']; - $dest_path = dirname( $source ); + $source = STORAGE_PKG_PATH.$pParamHash['upload']['dest_branch'].$pParamHash['upload']['name']; + $destPath = dirname( $source ); // set some default values if ffpeg-php isn't available or fails $default['aspect'] = 4 / 3; @@ -285,7 +285,7 @@ function mime_video_converter( &$pParamHash, $pOnlyGetParameters = FALSE ) { ) { // work out what the target filename is $extension = (( $info['vcodec'] == "flv" ) ? "flv" : "mp4" ); - $dest_file = $dest_path."/flick.$extension"; + $dest_file = $destPath."/flick.$extension"; // if the video can be processed by ffmpeg-php, width and height are greater than 1 if( !empty( $info['width'] ) && $info['width'] > 1 ) { @@ -310,7 +310,7 @@ function mime_video_converter( &$pParamHash, $pOnlyGetParameters = FALSE ) { } else { // work out what the target filename is $extension = (( $codec == "flv" ) ? "flv" : "mp4" ); - $dest_file = $dest_path."/flick.$extension"; + $dest_file = $destPath."/flick.$extension"; // if the video can be processed by ffmpeg-php, width and height are greater than 1 if( !empty( $info['width'] ) && $info['width'] > 1 ) { @@ -459,14 +459,14 @@ function mime_video_converter( &$pParamHash, $pOnlyGetParameters = FALSE ) { // remove unsuccessfully converted file @unlink( $dest_file ); $log['message'] = "ERROR: The video you uploaded could not be converted by ffmpeg.\nDEBUG OUTPUT:\n\n".$debug; - $actionLog['log_message'] = "Video could not be converted to flashvideo. An error dump was saved to: ".$dest_path.'/error'; + $actionLog['log_message'] = "Video could not be converted to flashvideo. An error dump was saved to: ".$destPath.'/error'; // write error message to error file - $h = fopen( $dest_path."/error", 'w' ); + $h = fopen( $destPath."/error", 'w' ); fwrite( $h, "$ffmpeg $parameters\n\n$debug" ); fclose( $h ); } - @unlink( $dest_path.'/processing' ); + @unlink( $destPath.'/processing' ); } } @@ -501,7 +501,7 @@ function mime_video_create_thumbnail( $pFile, $pOffset = 60 ) { global $gBitSystem; $ret = FALSE; if( !empty( $pFile ) && is_file( $pFile )) { - $dest_path = dirname( $pFile ); + $destPath = dirname( $pFile ); // try to use an app designed specifically to extract a thumbnail if( shell_exec( shell_exec( 'which ffmpegthumbnailer' ).' -h' )) { @@ -511,31 +511,31 @@ function mime_video_create_thumbnail( $pFile, $pOffset = 60 ) { } if( !empty( $thumbnailer ) && is_executable( $thumbnailer )) { - shell_exec( "$thumbnailer -i '$pFile' -o '$dest_path/thumb.jpg' -s 1024" ); + shell_exec( "$thumbnailer -i '$pFile' -o '$destPath/thumb.jpg' -s 1024" ); } - if( is_file( "$dest_path/thumb.jpg" ) && filesize( "$dest_path/thumb.jpg" ) > 1 ) { + if( is_file( "$destPath/thumb.jpg" ) && filesize( "$destPath/thumb.jpg" ) > 1 ) { $fileHash['type'] = 'image/jpg'; - $fileHash['source_file'] = "$dest_path/thumb.jpg"; - $fileHash['dest_path'] = str_replace( STORAGE_PKG_PATH, '', "$dest_path/" ); + $fileHash['source_file'] = "$destPath/thumb.jpg"; + $fileHash['dest_branch'] = str_replace( STORAGE_PKG_PATH, '', "$destPath/" ); liberty_generate_thumbnails( $fileHash ); $ret = TRUE; // remove temp file - @unlink( "$dest_path/thumb.jpg" ); + @unlink( "$destPath/thumb.jpg" ); } else { // fall back to using ffmepg $ffmpeg = trim( $gBitSystem->getConfig( 'ffmpeg_path', shell_exec( 'which ffmpeg' ))); - shell_exec( "$ffmpeg -i '$pFile' -an -ss $pOffset -t 00:00:01 -r 1 -y '$dest_path/preview%d.jpg'" ); - if( is_file( "$dest_path/preview1.jpg" )) { + shell_exec( "$ffmpeg -i '$pFile' -an -ss $pOffset -t 00:00:01 -r 1 -y '$destPath/preview%d.jpg'" ); + if( is_file( "$destPath/preview1.jpg" )) { $fileHash['type'] = 'image/jpg'; - $fileHash['source_file'] = "$dest_path/preview1.jpg"; - $fileHash['dest_path'] = str_replace( STORAGE_PKG_PATH, '', "$dest_path/" ); + $fileHash['source_file'] = "$destPath/preview1.jpg"; + $fileHash['dest_branch'] = str_replace( STORAGE_PKG_PATH, '', "$destPath/" ); liberty_generate_thumbnails( $fileHash ); $ret = TRUE; // remove temp file - @unlink( "$dest_path/preview1.jpg" ); + @unlink( "$destPath/preview1.jpg" ); } } } diff --git a/plugins/processor.gd.php b/plugins/processor.gd.php index ee32f67..b5cc52b 100644 --- a/plugins/processor.gd.php +++ b/plugins/processor.gd.php @@ -86,7 +86,7 @@ function liberty_gd_resize_image( &$pFileHash ) { if( !empty( $pFileHash['dest_file'] ) ) { $destFile = $pFileHash['dest_file']; } else { - $destFile = STORAGE_PKG_PATH.$pFileHash['dest_path'].$pFileHash['dest_base_name'].$destExt; + $destFile = STORAGE_PKG_PATH.$pFileHash['dest_branch'].$pFileHash['dest_base_name'].$destExt; } switch( $targetType ) { diff --git a/plugins/processor.imagick.php b/plugins/processor.imagick.php index cc9d3dd..3743bbe 100644 --- a/plugins/processor.imagick.php +++ b/plugins/processor.imagick.php @@ -129,7 +129,7 @@ function liberty_imagick0_resize_image( &$pFileHash ) { if( !empty( $pFileHash['dest_file'] ) ) { $destFile = $pFileHash['dest_file']; } else { - $destFile = STORAGE_PKG_PATH.$pFileHash['dest_path'].$pFileHash['dest_base_name'].$destExt; + $destFile = STORAGE_PKG_PATH.$pFileHash['dest_branch'].$pFileHash['dest_base_name'].$destExt; } $pFileHash['name'] = $pFileHash['dest_base_name'].$destExt; // print " if ( !imagick_resize( $iImg, $pFileHash[max_width], $pFileHash[max_height], IMAGICK_FILTER_LANCZOS, 0.5, $pFileHash[max_width] x $pFileHash[max_height] > ) ) {"; @@ -240,7 +240,7 @@ function liberty_imagick2_resize_image( &$pFileHash ) { if( !empty( $pFileHash['dest_file'] ) ) { $destFile = $pFileHash['dest_file']; } else { - $destFile = STORAGE_PKG_PATH.$pFileHash['dest_path'].$pFileHash['dest_base_name'].$destExt; + $destFile = STORAGE_PKG_PATH.$pFileHash['dest_branch'].$pFileHash['dest_base_name'].$destExt; } $pFileHash['name'] = $pFileHash['dest_base_name'].$destExt; diff --git a/plugins/processor.magickwand.php b/plugins/processor.magickwand.php index 39a7e5b..0d7f44b 100644 --- a/plugins/processor.magickwand.php +++ b/plugins/processor.magickwand.php @@ -101,7 +101,7 @@ function liberty_magickwand_resize_image( &$pFileHash ) { if( !empty( $pFileHash['dest_file'] ) ) { $destFile = $pFileHash['dest_file']; } else { - $destFile = $pFileHash['dest_path'].$pFileHash['dest_base_name'].$destExt; + $destFile = STORAGE_PKG_PATH.$pFileHash['dest_branch'].$pFileHash['dest_base_name'].$destExt; } $pFileHash['name'] = $pFileHash['dest_base_name'].$destExt; @@ -218,7 +218,7 @@ function liberty_magickwand_convert_colorspace_image( &$pFileHash, $pColorSpace } else { MagickSetImageColorspace( $magickWand, MW_GRAYColorspace ); if( empty( $pFileHash['dest_file'] ) ) { - $pFileHash['dest_file'] = $pFileHash['dest_path'].$pFileHash['name']; + $pFileHash['dest_file'] = STORAGE_PKG_PATH.$pFileHash['dest_branch'].$pFileHash['name']; } if( $error = liberty_magickwand_check_error( MagickWriteImage( $magickWand, $pFileHash['dest_file'] ), $magickWand ) ) { bit_log_error( "MagickWriteImage Failed:$error ( $pFileHash[source_file] )" ); diff --git a/plugins/storage.bitfile.php b/plugins/storage.bitfile.php index 92d1227..8e1e999 100644 --- a/plugins/storage.bitfile.php +++ b/plugins/storage.bitfile.php @@ -76,12 +76,12 @@ function bit_files_store( &$pStoreRow ) { if( @BitBase::verifyId( $pStoreRow['foreign_id'] ) ) { $sql = "UPDATE `".BIT_DB_PREFIX."liberty_files` SET `file_name`=?, `mime_type`=?, `file_size`=? WHERE `file_id` = ?"; - $gBitSystem->mDb->query( $sql, array( $pStoreRow['upload']['dest_path'].$pStoreRow['upload']['name'], $pStoreRow['upload']['type'], $pStoreRow['upload']['size'], $pStoreRow['foreign_id'] ) ); + $gBitSystem->mDb->query( $sql, array( $pStoreRow['upload']['name'], $pStoreRow['upload']['type'], $pStoreRow['upload']['size'], $pStoreRow['foreign_id'] ) ); } else { $pStoreRow['foreign_id'] = $gBitSystem->mDb->GenID( 'liberty_files_id_seq' ); $sql = "INSERT INTO `".BIT_DB_PREFIX."liberty_files` ( `file_name`, `file_id`, `mime_type`, `file_size`, `user_id` ) VALUES ( ?, ?, ?, ?, ? )"; $userId = !empty( $pStoreRow['upload']['user_id'] ) ? $pStoreRow['upload']['user_id'] : $gBitUser->mUserId; - $gBitSystem->mDb->query($sql, array( $pStoreRow['upload']['dest_path'].$pStoreRow['upload']['name'], $pStoreRow['foreign_id'], $pStoreRow['upload']['type'], $pStoreRow['upload']['size'], $userId ) ); + $gBitSystem->mDb->query($sql, array( $pStoreRow['upload']['name'], $pStoreRow['foreign_id'], $pStoreRow['upload']['type'], $pStoreRow['upload']['size'], $userId ) ); } return $ret; } |
