1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
| <?php $_LW->REGISTERED_APPS['my_app']=[ 'title'=>'My App', 'handlers'=>['onValidateUpload'], ];
class LiveWhaleApplicationMyApp {
public function onValidateUpload($data_type, $info) { global $_LW; if ($data_type=='images') {
if (!in_array(@$info['extension'], array('jpg','jpeg'))) { return 'Only JPG images are permitted.'; }; if ($sizes=getimagesize(@$info['tmp_name'])) {
if ($sizes[0]<900 || $sizes[1]<600) { return 'Images must be minimum 900 pixels wide and 600 pixels tall.'; } else if ($sizes[0]!=$sizes[1]*1.5) { return 'Uploaded images must conform to a 3:2 ratio of width:height.'; } }; }; }
} ?>
|