Plugin Directory

Changeset 1321819


Ignore:
Timestamp:
01/05/2016 06:02:24 PM (10 years ago)
Author:
hunk
Message:

tag 2.3.2.2

Location:
magic-fields-2/trunk
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • magic-fields-2/trunk/MF_thumb.php

    r979682 r1321819  
    8686    function image_resize35( $file, $max_w, $max_h, $crop = false, $far = false, $iar = false, $dest_path = null, $jpeg_quality = 90 ) {
    8787        $image = wp_get_image_editor( $file );
    88 
    8988        if ( is_wp_error( $image ) )
    90             return new WP_Error('error_loading_image', $image);
     89            return $image;
    9190
    9291        $size = @getimagesize( $file );
  • magic-fields-2/trunk/admin/mf_ajax_call.php

    r1256030 r1321819  
    260260    $field_id = preg_replace('/thumb_/','',$data['field_id']);
    261261
     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
    262268    if( count($info)){
    263269      $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);
    265271      echo json_encode($data);
    266272    }
  • magic-fields-2/trunk/admin/mf_upload.php

    r640332 r1321819  
    7878          @chmod(MF_FILES_DIR . $filename, 0644);
    7979          $info = pathinfo(MF_FILES_DIR . $filename);
    80          
     80
     81          $thumb =  aux_image($filename,"w=150&h=120&zc=1",'image_alt');
    8182          $resp = array(
    8283            'error' => false,
     
    9091            'msg' => __("Successful upload",$mf_domain)
    9192          );
     93
     94          if ( is_wp_error($thumb) ){
     95            $resp['error'] = true;
     96            $resp['msg'] = html_entity_decode($thumb->get_error_message());
     97          }
    9298        }
    9399      }else{
  • magic-fields-2/trunk/css/mf_field_base.css

    r1256030 r1321819  
    322322  display: block;
    323323  line-height: 16px;
     324  padding-bottom: 10px
    324325}
    325326.mf-upload-success {
  • magic-fields-2/trunk/field_types/image_field/image_field.php

    r761841 r1321819  
    8585    $field_style = '';
    8686    $imageThumbID = "img_thumb_".$field['input_id'];
     87    $error = '';
    8788    if(!$field['input_value']){
    8889      $value = sprintf('%simages/noimage.jpg',MF_URL);
    8990      $field_style = 'style="display:none;"';
    9091    }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      }
    92108    }
    93109 
     
    110126    $out .= '</div></div>';
    111127    $out .= '</div>';
     128    $out .= $error;
    112129
    113130    return $out;
  • magic-fields-2/trunk/field_types/image_media_field/image_media_field.php

    r1256030 r1321819  
    8484    $imageThumbID = "img_thumb_".$field['input_id'];
    8585    $path_image_media = '';
     86    $error = '';
    8687    if(!$field['input_value']){
    8788      $value = sprintf('%simages/noimage.jpg',MF_URL);
     
    9495      $path_image_media = $info[0];
    9596      $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      }
    96109    }
    97110 
     
    115128    $out .= '</div></div>';
    116129    $out .= '</div>';
     130    $out .= $error;
    117131    return $out;
    118132  }
  • magic-fields-2/trunk/field_types/textbox_field/textbox_field.php

    r1256030 r1321819  
    6464    $output = '';
    6565    $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) ){
    6867      $max = sprintf('maxlength="%s"',$field['options']['size']);
    6968    }
  • magic-fields-2/trunk/js/mf_admin.js

    r1256030 r1321819  
    220220      data: "action=mf_call&type=get_thumb&image_id="+id+"&field_id="+id_element,
    221221      success: function(response){
     222
     223        if (response.error == true) {
     224          show_error_image_field(response.field_id,response.msg);
     225          return;
     226        }
     227
    222228        jQuery('#img_thumb_'+response.field_id, top.document).attr('src',response.thumb);
    223229        jQuery('#'+response.field_id, top.document).attr('value',response.image_value);
     
    303309
    304310}
     311
     312function 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  
    44 * Plugin URI: http://magicfields.org
    55 * Description: Create custom fields for your post types
    6  * Version: 2.3.2.1
     6 * Version: 2.3.2.2
    77 * Author:  Hunk
    88 * Author URI: http://magicfields.org
  • magic-fields-2/trunk/mf_front_end.php

    r1256030 r1321819  
    254254 */
    255255function create_image($options){
    256   global $post;
     256  global $post,$mf_domain;
    257257   
    258258  // establish the default values, then override them with
     
    343343    //generate or check de thumb
    344344    $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   
    345351  }
    346352
     
    433439    }   
    434440   
    435     if ( is_wp_error($thumb_path) )
     441    if ( is_wp_error($thumb_path) ){
     442      return $thumb_path;
    436443      return $thumb_path->get_error_message();
     444    }
     445   
    437446    $value = $final_filename;
    438447  }
     
    462471          }else{
    463472            $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            }
    464477          }
    465478        }
     
    478491          }else{
    479492            $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            }
    480497          }
    481498        }
     
    507524          }else{
    508525            $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            }
    509530          }
    510531        }
  • magic-fields-2/trunk/readme.txt

    r1257627 r1321819  
    55Requires at least: 3.1
    66Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=edgar%40programador%2ecom&lc=GB&item_name=Donation%20Magic%20Fields&currency_code=USD&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHostedGuest
    7 Stable tag: 2.3.2.1
     7Stable tag: 2.3.2.2
    88Description:  Magic Fields 2 is a feature rich Wordpress CMS plugin
    99
     
    2828
    2929== 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
    3035
    3136= 2.3.2.1 =
Note: See TracChangeset for help on using the changeset viewer.