Changeset 12796 for trunk/include/ws_functions.inc.php
- Timestamp:
- Dec 27, 2011, 6:26:44 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/ws_functions.inc.php
r12749 r12796 147 147 function ws_std_get_urls($image_row) 148 148 { 149 $ret = array( 150 'tn_url' => get_thumbnail_url($image_row), 151 'element_url' => get_element_url($image_row) 152 ); 149 $ret = array(); 153 150 global $user; 154 if ($user['enabled_high'] and $image_row['has_high'] ) 155 { 156 $ret['high_url'] = get_high_url($image_row); 157 } 151 if ($user['enabled_high']) 152 { 153 $ret['element_url'] = get_element_url($image_row); 154 } 155 156 $derivatives = DerivativeImage::get_all($image_row); 157 $derivatives_arr = array(); 158 foreach($derivatives as $type=>$derivative) 159 { 160 $size = $derivative->get_size(); 161 $size != null or $size=array(null,null); 162 $derivatives_arr[$type] = array('url' => $derivative->get_url(), 'width'=>$size[0], 'height'=>$size[1] ); 163 } 164 $ret['derivatives'] = $derivatives_arr;; 158 165 return $ret; 159 166 } … … 166 173 { 167 174 return array( 168 'id',' tn_url','element_url','high_url', 'file','width','height','hit','date_available','date_creation'175 'id','element_url', 'file','width','height','hit','date_available','date_creation' 169 176 ); 170 177 } … … 621 628 622 629 $query = ' 623 SELECT id, path, tn_ext, level630 SELECT id, path, representative_ext, level 624 631 FROM '.IMAGES_TABLE.' 625 632 WHERE id IN ('.implode(',', $image_ids).') … … 630 637 if ($row['level'] <= $user['level']) 631 638 { 632 $thumbnail_src_of[$row['id']] = get_thumbnail_url($row);639 $thumbnail_src_of[$row['id']] = DerivativeImage::thumb_url($row); 633 640 } 634 641 else … … 669 676 { 670 677 $query = ' 671 SELECT id, path, tn_ext678 SELECT id, path, representative_ext 672 679 FROM '.IMAGES_TABLE.' 673 680 WHERE id IN ('.implode(',', $new_image_ids).') … … 676 683 while ($row = pwg_db_fetch_assoc($result)) 677 684 { 678 $thumbnail_src_of[$row['id']] = get_thumbnail_url($row);685 $thumbnail_src_of[$row['id']] = DerivativeImage::thumb_url($row); 679 686 } 680 687 } … … 1371 1378 if (!is_dir($upload_dir)) { 1372 1379 umask(0000); 1373 $recursive = true; 1374 if (!@mkdir($upload_dir, 0777, $recursive)) 1380 if (!@mkdir($upload_dir, 0777, true)) 1375 1381 { 1376 1382 return new PwgError(500, 'error during buffer directory creation'); … … 1425 1431 if (is_file($output_filepath)) 1426 1432 { 1427 new PwgError(500, '[merge_chunks] error while trying to remove existing '.$output_filepath); 1428 exit(); 1433 return new PwgError(500, '[merge_chunks] error while trying to remove existing '.$output_filepath); 1429 1434 } 1430 1435 } … … 1465 1470 if (!file_put_contents($output_filepath, $string, FILE_APPEND)) 1466 1471 { 1467 new PwgError(500, '[merge_chunks] error while writting chunks for '.$output_filepath); 1468 exit(); 1472 return new PwgError(500, '[merge_chunks] error while writting chunks for '.$output_filepath); 1469 1473 } 1470 1474 … … 1501 1505 if (!@mkdir($upload_dir, 0777, $recursive)) 1502 1506 { 1503 new PwgError(500, '[add_file] error during '.$type.' directory creation'); 1504 exit(); 1507 return new PwgError(500, '[add_file] error during '.$type.' directory creation'); 1505 1508 } 1506 1509 } … … 1513 1516 if (!is_writable($upload_dir)) 1514 1517 { 1515 new PwgError(500, '[add_file] '.$type.' directory has no write access'); 1516 exit(); 1518 return new PwgError(500, '[add_file] '.$type.' directory has no write access'); 1517 1519 } 1518 1520 } … … 1526 1528 // check dumped thumbnail md5 1527 1529 $dumped_md5 = md5_file($file_path); 1528 if ($dumped_md5 != $file_sum) {1529 new PwgError(500, '[add_file] '.$type.' transfer failed');1530 exit();1530 if ($dumped_md5 != $file_sum) 1531 { 1532 return new PwgError(500, '[add_file] '.$type.' transfer failed'); 1531 1533 } 1532 1534 … … 2452 2454 else 2453 2455 { 2454 new PwgError(2456 return new PwgError( 2455 2457 500, 2456 2458 '[ws_images_setInfo]' … … 2458 2460 .', possible values are {fill_if_empty, replace}.' 2459 2461 ); 2460 exit();2461 2462 } 2462 2463 } … … 2467 2468 if (!empty($image_row['storage_category_id'])) 2468 2469 { 2469 new PwgError(500, '[ws_images_setInfo] updating "file" is forbidden on photos added by synchronization'); 2470 exit(); 2470 return new PwgError(500, '[ws_images_setInfo] updating "file" is forbidden on photos added by synchronization'); 2471 2471 } 2472 2472 … … 2518 2518 else 2519 2519 { 2520 new PwgError(2520 return new PwgError( 2521 2521 500, 2522 2522 '[ws_images_setInfo]' … … 2524 2524 .', possible values are {replace, append}.' 2525 2525 ); 2526 exit();2527 2526 } 2528 2527 } … … 2611 2610 if (count($cat_ids) == 0) 2612 2611 { 2613 new PwgError(2612 return new PwgError( 2614 2613 500, 2615 2614 '[ws_add_image_category_relations] there is no category defined in "'.$categories_string.'"' 2616 2615 ); 2617 exit();2618 2616 } 2619 2617 … … 2629 2627 if (count($unknown_cat_ids) != 0) 2630 2628 { 2631 new PwgError(2629 return new PwgError( 2632 2630 500, 2633 2631 '[ws_add_image_category_relations] the following categories are unknown: '.implode(', ', $unknown_cat_ids) 2634 2632 ); 2635 exit();2636 2633 } 2637 2634
Note: See TracChangeset
for help on using the changeset viewer.