File tree Expand file tree Collapse file tree 2 files changed +32
-27
lines changed
assets/src/dashboard/parts/connected/settings Expand file tree Collapse file tree 2 files changed +32
-27
lines changed Original file line number Diff line number Diff line change @@ -39,6 +39,30 @@ const Compression = ({
3939 isSampleLoading,
4040 setIsSampleLoading
4141} ) => {
42+ const getQuality = value => {
43+ if ( 'number' === typeof value ) {
44+ return value ;
45+ }
46+
47+ if ( 'auto' === value || 'mauto' === value ) {
48+ return 80 ;
49+ }
50+
51+ if ( 'high_c' === value ) {
52+ return 90 ;
53+ }
54+
55+ if ( 'medium_c' === value ) {
56+ return 75 ;
57+ }
58+
59+ if ( 'low_c' === value ) {
60+ return 55 ;
61+ }
62+
63+ return 80 ;
64+ } ;
65+
4266 const {
4367 sampleImages,
4468 isLoading
@@ -60,6 +84,7 @@ const Compression = ({
6084 const isBestFormatEnabled = 'disabled' !== settings [ 'best_format' ] ;
6185 const compressionMode = settings [ 'compression_mode' ] ;
6286 const isRetinaEnabled = 'disabled' !== settings [ 'retina_images' ] ;
87+
6388 const updateOption = ( option , value ) => {
6489 setCanSave ( true ) ;
6590 const data = { ...settings } ;
@@ -79,30 +104,6 @@ const Compression = ({
79104 ) ;
80105 } ;
81106
82- const getQuality = value => {
83- if ( 'number' === typeof value ) {
84- return value ;
85- }
86-
87- if ( 'auto' === value ) {
88- return 90 ;
89- }
90-
91- if ( 'high_c' === value ) {
92- return 90 ;
93- }
94-
95- if ( 'medium_c' === value ) {
96- return 75 ;
97- }
98-
99- if ( 'low_c' === value ) {
100- return 55 ;
101- }
102-
103- return 90 ;
104- } ;
105-
106107 const updateQuality = value => {
107108 setCanSave ( true ) ;
108109 const data = { ...settings } ;
Original file line number Diff line number Diff line change @@ -75,7 +75,7 @@ class Optml_Settings {
7575 'compression_mode ' => 'custom ' ,
7676 'cloud_sites ' => [ 'all ' => 'true ' ],
7777 'watchers ' => '' ,
78- 'quality ' => ' auto ' ,
78+ 'quality ' => 80 ,
7979 'wm_id ' => - 1 ,
8080 'wm_opacity ' => 1 ,
8181 'wm_position ' => Position::SOUTH_EAST ,
@@ -237,7 +237,9 @@ public function auto_connect() {
237237 * @return array
238238 */
239239 public function parse_settings ( $ new_settings ) {
240- $ sanitized = [];
240+ $ sanitized = [];
241+ $ sanitized_value = '' ;
242+
241243 foreach ( $ new_settings as $ key => $ value ) {
242244 switch ( $ key ) {
243245 case 'admin_bar_item ' :
@@ -278,7 +280,9 @@ public function parse_settings( $new_settings ) {
278280 $ sanitized_value = $ this ->to_bound_integer ( $ value , 100 , 5000 );
279281 break ;
280282 case 'quality ' :
281- $ sanitized_value = $ this ->to_bound_integer ( $ value , 1 , 100 );
283+ if ( 'mauto ' !== $ value ) {
284+ $ sanitized_value = $ this ->to_bound_integer ( $ value , 50 , 100 );
285+ }
282286 break ;
283287 case 'wm_id ' :
284288 $ sanitized_value = intval ( $ value );
You can’t perform that action at this time.
0 commit comments