classes/Tools/Imgix/ImgixTool.php
private function doUpdatePresets($key, $name, $settings, $size, $makeDefault) {
		$image_id = esc_html($_POST['image_id']);
		$presets = get_option('ilab-imgix-presets');
		if(!$presets) {
			$presets = [];
		}

		$presets[$key] = [
			'title' => $name,
			'settings' => $settings
		];
		update_option('ilab-imgix-presets', $presets);

		$sizePresets = get_option('ilab-imgix-size-presets');
		if(!$sizePresets) {
			$sizePresets = [];
		}

		if($size && $makeDefault) {
			$sizePresets[$size] = $key;
		} else if($size && !$makeDefault) {
			foreach($sizePresets as $s => $k) {
				if($k == $key) {
					unset($sizePresets[$s]);
				}
			}
		}

		update_option('ilab-imgix-size-presets', $sizePresets);

		json_response([
			              'status' => 'ok',
			              'currentPreset' => $key,
			              'presets' => $this->buildPresetsUI($image_id, $size)
		              ]);

	}
private function doUpdatePresets($key, $name, $settings, $size, $makeDefault) {
		$image_id = esc_html($_POST['image_id']);
		$presets = get_option('ilab-imgix-presets');
		if(!$presets) {
			$presets = [];
		}

		$presets[$key] = [
			'title' => $name,
			'settings' => $settings
		];
		update_option('ilab-imgix-presets', $presets);

		$sizePresets = get_option('ilab-imgix-size-presets');
		if(!$sizePresets) {
			$sizePresets = [];
		}

		if($size && $makeDefault) {
			$sizePresets[$size] = $key;
		} else if($size && !$makeDefault) {
			foreach($sizePresets as $s => $k) {
				if($k == $key) {
					unset($sizePresets[$s]);
				}
			}
		}

		update_option('ilab-imgix-size-presets', $sizePresets);

		json_response([
			              'status' => 'ok',
			              'currentPreset' => $key,
			              'presets' => $this->buildPresetsUI($image_id, $size)
		              ]);

	}
private function doUpdatePresets ( $ key , $ name , $ settings , $ size , $ makeDefault ) { $ image_id = esc_html ( $ _POST [ 'image_id' ] ) ; $ presets = get_option ( 'ilab-imgix-presets' ) ; if ( ! $ presets ) { $ presets = [ ] ; } $ presets [ $ key ] = [ 'title' => $ name , 'settings' => $ settings ] ; update_option ( 'ilab-imgix-presets' , $ presets ) ; $ sizePresets = get_option ( 'ilab-imgix-size-presets' ) ; if ( ! $ sizePresets ) { $ sizePresets = [ ] ; } if ( $ size && $ makeDefault ) { $ sizePresets [ $ size ] = $ key ; } else if ( $ size && ! $ makeDefault ) { foreach ( $ sizePresets as $ s => $ k ) { if ( $ k == $ key ) { unset ( $ sizePresets [ $ s ] ) ; } } } update_option ( 'ilab-imgix-size-presets' , $ sizePresets ) ; json_response ( [ 'status' => 'ok' , 'currentPreset' => $ key , 'presets' => $ this -> buildPresetsUI ( $ image_id , $ size ) ] ) ; }
Update the presets

@param string $key
@param string $name
@param array $settings
@param string $size
@param bool $makeDefault
Update the presets