PluginProbe
WPJAM Basic / trunk
WPJAM Basic vtrunk
wpjam-basic / cdn / ucloud.php

ucloud.php in WPJAM Basic trunk, at cdn/ucloud.php

49 lines 901 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 function wpjam_get_ucloud_thumbnail($img_url, $args=array()){
3 if(!wpjam_is_image($img_url) || !wpjam_is_cdn_url($img_url)){
4 return $img_url;
5 }
6
7 extract(wp_parse_args($args, array(
8 'crop' => 1,
9 'width' => 0,
10 'height' => 0,
11 'mode' => null,
12 'format' => '',
13 'interlace' => 0,
14 'quality' => 0,
15 )));
16
17 if($height > 10000){
18 $height = 0;
19 }
20
21 if($width > 10000){
22 $height = 0;
23 }
24
25 if($width || $height){
26 $arg['iopcmd'] = 'thumbnail';
27
28 if($width && $height){
29 $arg['type'] = 13;
30 $arg['height'] = $height;
31 $arg['width'] = $width;
32 }elseif($width){
33 $arg['type'] = 4;
34 $arg['width'] = $width;
35 }elseif($height){
36 $arg['type'] = 5;
37 $arg['height'] = $height;
38 }
39
40 if(strpos($img_url, 'iopcmd=thumbnail') === false){
41 $img_url = add_query_arg($arg, $img_url );
42 $img_url = $img_url.'#';
43 }
44 }
45
46 return $img_url;
47 }
48
49 return 'wpjam_get_ucloud_thumbnail';