addMethod( 'pwg.images.regenerateWebsize', 'ws_images_regenerateWebsize', array( 'image_id' => array(), 'maxwidth' => array('default'=>$conf['upload_form_websize_maxwidth']), 'maxheight' => array('default'=>$conf['upload_form_websize_maxheight']), 'quality' => array('default'=>$conf['upload_form_websize_quality']), ), 'Regenerate websize images from HD with given arguments.' ); function ws_images_regenerateWebsize($params, &$service) { global $conf; if (!is_admin()) return new PwgError(401, 'Access denied'); $query=' SELECT id, path, has_high, width, height FROM '.IMAGES_TABLE.' WHERE id = '.(int)$params['image_id'].' ;'; $image = pwg_db_fetch_assoc(pwg_query($query)); if ($image == null) return new PwgError(404, "image_id not found"); include_once(PHPWG_ROOT_PATH.'admin/include/functions_upload.inc.php'); if (!empty( $image['has_high'] )) { trigger_event( 'upload_image_resize', false, file_path_for_type($image['path'], 'high'), $image['path'], $params['maxwidth'], $params['maxheight'], $params['quality'], false ); $conf['use_exif'] = false; $conf['use_iptc'] = false; update_metadata(array($image['id'] => $image['path'])); return true; } return false; } ?>