Changeset 23590 for extensions/download_by_size
- Timestamp:
- Jun 27, 2013, 3:30:48 PM (11 years ago)
- Location:
- extensions/download_by_size
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/download_by_size/action.php
r23324 r23590 131 131 132 132 // change the name of the file for download, suffix with _widthxheight before the extension 133 $basename = get_filename_wo_extension($element_info['file']); 134 $extension = get_extension($element_info['file']); 135 $element_info['file'] = $basename.'_'.$size[0].'x'.$size[1].'.'.$extension; 133 $element_info['file'] = dlsize_getFilename( 134 $element_info, 135 array( 136 'width'=>$size[0], 137 'height'=>$size[1] 138 ) 139 ); 136 140 } 137 141 else -
extensions/download_by_size/main.inc.php
r23325 r23590 68 68 } 69 69 70 /** 71 * getFilename function, copied from Batch Manager 72 */ 73 function dlsize_getFilename($row, $filesize=array()) 74 { 75 global $conf; 76 77 if (!isset($conf['download_by_size_file_pattern'])) 78 { 79 $conf['download_by_size_file_pattern'] = '%filename%_%dimensions%'; 80 } 81 82 $row['filename'] = stripslashes(get_filename_wo_extension($row['file'])); 83 84 $search = array('%id%', '%filename%', '%author%', '%dimensions%'); 85 $replace = array($row['id'], $row['filename']); 86 87 if (!empty($row['author'])) $replace[] = $row['author']; 88 else $replace[] = null; 89 90 if (!empty($filesize)) $replace[] = $filesize['width'].'x'.$filesize['height']; 91 else $replace[] = null; 92 93 $filename = str_replace($search, $replace, $conf['download_by_size_file_pattern']); 94 $filename = preg_replace(array('#_+#', '#^_#', '#_$#'), array('_', null, null), $filename); 95 96 if (empty($filename) || $filename == $conf['download_by_size_file_pattern']) 97 { 98 $filename = $row['filename']; 99 } 100 101 $filename.= '.'.get_extension($row['path']); 102 103 return $filename; 104 } 70 105 ?>
Note: See TracChangeset
for help on using the changeset viewer.