Changeset 1321819
- Timestamp:
- 01/05/2016 06:02:24 PM (10 years ago)
- Location:
- magic-fields-2/trunk
- Files:
-
- 11 edited
-
MF_thumb.php (modified) (1 diff)
-
admin/mf_ajax_call.php (modified) (1 diff)
-
admin/mf_upload.php (modified) (2 diffs)
-
css/mf_field_base.css (modified) (1 diff)
-
field_types/image_field/image_field.php (modified) (2 diffs)
-
field_types/image_media_field/image_media_field.php (modified) (3 diffs)
-
field_types/textbox_field/textbox_field.php (modified) (1 diff)
-
js/mf_admin.js (modified) (2 diffs)
-
main.php (modified) (1 diff)
-
mf_front_end.php (modified) (6 diffs)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
magic-fields-2/trunk/MF_thumb.php
r979682 r1321819 86 86 function image_resize35( $file, $max_w, $max_h, $crop = false, $far = false, $iar = false, $dest_path = null, $jpeg_quality = 90 ) { 87 87 $image = wp_get_image_editor( $file ); 88 89 88 if ( is_wp_error( $image ) ) 90 return new WP_Error('error_loading_image', $image);89 return $image; 91 90 92 91 $size = @getimagesize( $file ); -
magic-fields-2/trunk/admin/mf_ajax_call.php
r1256030 r1321819 260 260 $field_id = preg_replace('/thumb_/','',$data['field_id']); 261 261 262 if ( is_wp_error($thumb) ){ 263 $data = array('field_id' => $field_id,"error" => true, "msg" => html_entity_decode($thumb->get_error_message())); 264 echo json_encode($data); 265 return; 266 } 267 262 268 if( count($info)){ 263 269 $image_thumb = PHPTHUMB.'?&w=150&h=120&src='.$info[0]; 264 $data = array('image' => $image_thumb,'field_id' => $field_id,'image_value' => $image_id,'image_path' => $info[0],'thumb' => $thumb );270 $data = array('image' => $image_thumb,'field_id' => $field_id,'image_value' => $image_id,'image_path' => $info[0],'thumb' => $thumb,"error" => false); 265 271 echo json_encode($data); 266 272 } -
magic-fields-2/trunk/admin/mf_upload.php
r640332 r1321819 78 78 @chmod(MF_FILES_DIR . $filename, 0644); 79 79 $info = pathinfo(MF_FILES_DIR . $filename); 80 80 81 $thumb = aux_image($filename,"w=150&h=120&zc=1",'image_alt'); 81 82 $resp = array( 82 83 'error' => false, … … 90 91 'msg' => __("Successful upload",$mf_domain) 91 92 ); 93 94 if ( is_wp_error($thumb) ){ 95 $resp['error'] = true; 96 $resp['msg'] = html_entity_decode($thumb->get_error_message()); 97 } 92 98 } 93 99 }else{ -
magic-fields-2/trunk/css/mf_field_base.css
r1256030 r1321819 322 322 display: block; 323 323 line-height: 16px; 324 padding-bottom: 10px 324 325 } 325 326 .mf-upload-success { -
magic-fields-2/trunk/field_types/image_field/image_field.php
r761841 r1321819 85 85 $field_style = ''; 86 86 $imageThumbID = "img_thumb_".$field['input_id']; 87 $error = ''; 87 88 if(!$field['input_value']){ 88 89 $value = sprintf('%simages/noimage.jpg',MF_URL); 89 90 $field_style = 'style="display:none;"'; 90 91 }else{ 91 $value = sprintf("%s?src=%s%s&w=150&h=120&zc=1",PHPTHUMB,MF_FILES_URL,$field['input_value']); 92 // $value = sprintf("%s?src=%s%s&w=150&h=120&zc=1",PHPTHUMB,MF_FILES_URL,$field['input_value']); 93 $MFFrontEnd = MF_PATH.'/mf_front_end.php'; 94 require_once($MFFrontEnd); 95 $value = aux_image($field['input_value'],"w=150&h=120&zc=1",'image'); 96 97 if ( is_wp_error($value) ){ 98 $wp_error = $value; 99 $field_style = 'style="display:none;"'; 100 $value = sprintf('%simages/noimage.jpg',MF_URL); 101 // $value = $path_image_media; 102 $error = "<script type=\"text/javascript\"> 103 jQuery(document).ready(function($){ 104 show_error_image_field('".$field['input_id']."','".html_entity_decode($wp_error->get_error_message())."'); 105 }); 106 </script>"; 107 } 92 108 } 93 109 … … 110 126 $out .= '</div></div>'; 111 127 $out .= '</div>'; 128 $out .= $error; 112 129 113 130 return $out; -
magic-fields-2/trunk/field_types/image_media_field/image_media_field.php
r1256030 r1321819 84 84 $imageThumbID = "img_thumb_".$field['input_id']; 85 85 $path_image_media = ''; 86 $error = ''; 86 87 if(!$field['input_value']){ 87 88 $value = sprintf('%simages/noimage.jpg',MF_URL); … … 94 95 $path_image_media = $info[0]; 95 96 $value = aux_image($path_image_media,"w=150&h=120&zc=1",'image_media'); 97 98 if ( is_wp_error($value) ){ 99 $wp_error = $value; 100 $field_style = 'style="display:none;"'; 101 $value = sprintf('%simages/noimage.jpg',MF_URL); 102 // $value = $path_image_media; 103 $error = "<script type=\"text/javascript\"> 104 jQuery(document).ready(function($){ 105 show_error_image_field('".$field['input_id']."','".html_entity_decode($wp_error->get_error_message())."'); 106 }); 107 </script>"; 108 } 96 109 } 97 110 … … 115 128 $out .= '</div></div>'; 116 129 $out .= '</div>'; 130 $out .= $error; 117 131 return $out; 118 132 } -
magic-fields-2/trunk/field_types/textbox_field/textbox_field.php
r1256030 r1321819 64 64 $output = ''; 65 65 $max = ''; 66 67 if( isset($field['options']['evalueate']) && ($field['options']['size'] > 0) ){ 66 if( isset($field['options']['evalueate']) && $field['options']['evalueate'] == 1 && ($field['options']['size'] > 0) ){ 68 67 $max = sprintf('maxlength="%s"',$field['options']['size']); 69 68 } -
magic-fields-2/trunk/js/mf_admin.js
r1256030 r1321819 220 220 data: "action=mf_call&type=get_thumb&image_id="+id+"&field_id="+id_element, 221 221 success: function(response){ 222 223 if (response.error == true) { 224 show_error_image_field(response.field_id,response.msg); 225 return; 226 } 227 222 228 jQuery('#img_thumb_'+response.field_id, top.document).attr('src',response.thumb); 223 229 jQuery('#'+response.field_id, top.document).attr('value',response.image_value); … … 303 309 304 310 } 311 312 function show_error_image_field(elem,msg){ 313 var error_resp = '<span class="mf-upload-error" >'+msg+'</span>'; 314 jQuery('#response-'+elem).html(error_resp).show(); 315 setTimeout("remove_resp('#response-"+elem+"')",5000); 316 317 } -
magic-fields-2/trunk/main.php
r1257627 r1321819 4 4 * Plugin URI: http://magicfields.org 5 5 * Description: Create custom fields for your post types 6 * Version: 2.3.2. 16 * Version: 2.3.2.2 7 7 * Author: Hunk 8 8 * Author URI: http://magicfields.org -
magic-fields-2/trunk/mf_front_end.php
r1256030 r1321819 254 254 */ 255 255 function create_image($options){ 256 global $post ;256 global $post,$mf_domain; 257 257 258 258 // establish the default values, then override them with … … 343 343 //generate or check de thumb 344 344 $field_value = aux_image($field_value,$field_param,$field_type); 345 if ( is_wp_error($field_value) && defined('WP_DEBUG') && WP_DEBUG == true ){ 346 return sprintf("%s: %s",__('Error generating thumbnail, reason',$mf_domain),$field_value->get_error_message()); 347 } 348 349 return ""; 350 345 351 } 346 352 … … 433 439 } 434 440 435 if ( is_wp_error($thumb_path) ) 441 if ( is_wp_error($thumb_path) ){ 442 return $thumb_path; 436 443 return $thumb_path->get_error_message(); 444 } 445 437 446 $value = $final_filename; 438 447 } … … 462 471 }else{ 463 472 $result['thumb'] = aux_image($value,$options,$type); 473 if ( is_wp_error($result['thumb']) ){ 474 $result['error'] = $result['thumb']->get_error_message(); 475 $result['thumb'] = ''; 476 } 464 477 } 465 478 } … … 478 491 }else{ 479 492 $result['thumb'] = aux_image($value,$options,$type); 493 if ( is_wp_error($result['thumb']) ){ 494 $result['error'] = $result['thumb']->get_error_message(); 495 $result['thumb'] = ''; 496 } 480 497 } 481 498 } … … 507 524 }else{ 508 525 $result['thumb'] = aux_image($result['original'],$options,$type); 526 if ( is_wp_error($result['thumb']) ){ 527 $result['error'] = $result['thumb']->get_error_message(); 528 $result['thumb'] = ''; 529 } 509 530 } 510 531 } -
magic-fields-2/trunk/readme.txt
r1257627 r1321819 5 5 Requires at least: 3.1 6 6 Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=edgar%40programador%2ecom&lc=GB&item_name=Donation%20Magic%20Fields¤cy_code=USD&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHostedGuest 7 Stable tag: 2.3.2. 17 Stable tag: 2.3.2.2 8 8 Description: Magic Fields 2 is a feature rich Wordpress CMS plugin 9 9 … … 28 28 29 29 == Changelog == 30 31 = 2.3.2.2 = 32 * better way of handle error in image thumbnails 33 * fix problem of maxlength in textbox 34 * fixes for localization 30 35 31 36 = 2.3.2.1 =
Note: See TracChangeset
for help on using the changeset viewer.