helper_attach.php 899 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. /**
  3. * [Discuz!] (C)2001-2099 Comsenz Inc.
  4. * This is NOT a freeware, use is subject to license terms
  5. *
  6. * $Id: helper_attach.php 32531 2013-02-06 10:15:19Z zhangguosheng $
  7. */
  8. if(!defined('IN_DISCUZ')) {
  9. exit('Access Denied');
  10. }
  11. class helper_attach {
  12. public static function makethumbpath($id, $w, $h){
  13. $dw = intval($w);
  14. $dh = intval($h);
  15. $_daid = sprintf("%09d", $id);
  16. $dir1 = substr($_daid, 0, 3);
  17. $dir2 = substr($_daid, 3, 2);
  18. $dir3 = substr($_daid, 5, 2);
  19. return $dir1.'/'.$dir2.'/'.$dir3.'/'.substr($_daid, -2).'_'.$dw.'_'.$dh.'.jpg';
  20. }
  21. public static function attachpreurl() {
  22. static $attachurl = null;
  23. if($attachurl === null) {
  24. global $_G;
  25. $parse = parse_url($_G['setting']['attachurl']);
  26. $attachurl = !isset($parse['host']) ? $_G['siteurl'].$_G['setting']['attachurl'] : $_G['setting']['attachurl'];
  27. }
  28. return $attachurl;
  29. }
  30. }
  31. ?>