mirror of
https://github.com/10h30/ultimatemember.git
synced 2026-07-14 04:06:36 +09:00
Added Min-width / height option to crop
This commit is contained in:
+43
-49
@@ -253,8 +253,7 @@ function UM_domenus(){
|
||||
}
|
||||
|
||||
function um_responsive(){
|
||||
|
||||
// responsive um shortcode
|
||||
|
||||
jQuery('.um').each(function(){
|
||||
|
||||
element_width = jQuery(this).width();
|
||||
@@ -303,18 +302,15 @@ function um_responsive(){
|
||||
jQuery(this).removeClass('uimob960');
|
||||
|
||||
}
|
||||
|
||||
// account nav
|
||||
|
||||
if ( jQuery('.um-account-nav').length > 0 && jQuery('.um-account-side').is(':visible') && jQuery('.um-account-tab:visible').length == 0 ) {
|
||||
jQuery('.um-account-side li a.current').trigger('click');
|
||||
}
|
||||
|
||||
// show
|
||||
|
||||
jQuery(this).css('opacity',1);
|
||||
|
||||
});
|
||||
|
||||
// responsive cover
|
||||
|
||||
jQuery('.um-cover, .um-member-cover').each(function(){
|
||||
|
||||
var elem = jQuery(this);
|
||||
@@ -327,13 +323,11 @@ function um_responsive(){
|
||||
elem.find('.um-cover-add').height( calcHeight );
|
||||
|
||||
});
|
||||
|
||||
// members directory
|
||||
|
||||
jQuery('.um-members').each(function(){
|
||||
UM_Member_Grid( jQuery(this) );
|
||||
});
|
||||
|
||||
// menus
|
||||
UM_domenus();
|
||||
|
||||
}
|
||||
@@ -512,7 +506,6 @@ function initFileUpload_UM( trigger ) {
|
||||
|
||||
function initCrop_UM() {
|
||||
|
||||
// only when a crop image is in view
|
||||
var target_img = jQuery('.um-modal:visible .um-single-image-preview img');
|
||||
var target_img_parent = jQuery('.um-modal:visible .um-single-image-preview');
|
||||
|
||||
@@ -521,7 +514,6 @@ function initCrop_UM() {
|
||||
var min_height = target_img.parent().attr('data-min_height');
|
||||
var ratio = target_img.parent().attr('data-ratio');
|
||||
|
||||
// custom defined ratio maybe
|
||||
if ( jQuery('.um-modal').find('#um_upload_single').attr('data-ratio') ) {
|
||||
var ratio = jQuery('.um-modal').find('#um_upload_single').attr('data-ratio');
|
||||
var ratio_split = ratio.split(':');
|
||||
@@ -545,46 +537,48 @@ function initCrop_UM() {
|
||||
|
||||
if ( crop_data == 'square' ) {
|
||||
|
||||
var opts = {
|
||||
minWidth: min_width,
|
||||
minHeight: min_height,
|
||||
dragCrop: false,
|
||||
aspectRatio: 1.0,
|
||||
zoomable: false,
|
||||
rotatable: false,
|
||||
dashed: false,
|
||||
done: function(data) {
|
||||
target_img.parent().attr('data-coord', Math.round(data.x) + ',' + Math.round(data.y) + ',' + Math.round(data.width) + ',' + Math.round(data.height) );
|
||||
}
|
||||
};
|
||||
var opts = {
|
||||
minWidth: min_width,
|
||||
minHeight: min_height,
|
||||
dragCrop: false,
|
||||
aspectRatio: 1.0,
|
||||
zoomable: false,
|
||||
rotatable: false,
|
||||
dashed: false,
|
||||
done: function(data) {
|
||||
target_img.parent().attr('data-coord', Math.round(data.x) + ',' + Math.round(data.y) + ',' + Math.round(data.width) + ',' + Math.round(data.height) );
|
||||
}
|
||||
};
|
||||
|
||||
} else if ( crop_data == 'cover' ) {
|
||||
|
||||
var opts = {
|
||||
minWidth: min_width,
|
||||
minHeight: Math.round( min_width / ratio ),
|
||||
dragCrop: false,
|
||||
aspectRatio: ratio,
|
||||
zoomable: false,
|
||||
rotatable: false,
|
||||
dashed: false,
|
||||
done: function(data) {
|
||||
target_img.parent().attr('data-coord', Math.round(data.x) + ',' + Math.round(data.y) + ',' + Math.round(data.width) + ',' + Math.round(data.height) );
|
||||
}
|
||||
};
|
||||
var opts = {
|
||||
minWidth: min_width,
|
||||
minHeight: Math.round( min_width / ratio ),
|
||||
dragCrop: false,
|
||||
aspectRatio: ratio,
|
||||
zoomable: false,
|
||||
rotatable: false,
|
||||
dashed: false,
|
||||
done: function(data) {
|
||||
target_img.parent().attr('data-coord', Math.round(data.x) + ',' + Math.round(data.y) + ',' + Math.round(data.width) + ',' + Math.round(data.height) );
|
||||
}
|
||||
};
|
||||
|
||||
} else if ( crop_data == 'user' ) {
|
||||
|
||||
var opts = {
|
||||
dragCrop: true,
|
||||
aspectRatio: "auto",
|
||||
zoomable: false,
|
||||
rotatable: false,
|
||||
dashed: false,
|
||||
done: function(data) {
|
||||
target_img.parent().attr('data-coord', Math.round(data.x) + ',' + Math.round(data.y) + ',' + Math.round(data.width) + ',' + Math.round(data.height) );
|
||||
}
|
||||
};
|
||||
var opts = {
|
||||
minWidth: min_width,
|
||||
minHeight: min_height,
|
||||
dragCrop: true,
|
||||
aspectRatio: "auto",
|
||||
zoomable: false,
|
||||
rotatable: false,
|
||||
dashed: false,
|
||||
done: function(data) {
|
||||
target_img.parent().attr('data-coord', Math.round(data.x) + ',' + Math.round(data.y) + ',' + Math.round(data.width) + ',' + Math.round(data.height) );
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -601,7 +595,7 @@ function um_new_modal( id, size, isPhoto, source ){
|
||||
|
||||
var modal = jQuery('body').find('.um-modal-overlay');
|
||||
|
||||
if ( modal.length == 0 ) { // when new Modal is fired
|
||||
if ( modal.length == 0 ) {
|
||||
|
||||
jQuery('.tipsy').hide();
|
||||
|
||||
@@ -663,7 +657,7 @@ function um_new_modal( id, size, isPhoto, source ){
|
||||
|
||||
}
|
||||
|
||||
} // when new Modal is fired
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
@@ -701,9 +701,16 @@ class UM_Fields {
|
||||
}
|
||||
|
||||
if ( !isset( $array['ratio'] ) ) $array['ratio'] = 1.0;
|
||||
|
||||
if ( !isset( $array['min_width'] ) ) $array['min_width'] = '';
|
||||
if ( !isset( $array['min_height'] ) ) $array['min_height'] = '';
|
||||
|
||||
if ( $array['min_width'] == '' && $array['crop'] == 1 ) $array['min_width'] = 600;
|
||||
if ( $array['min_height'] == '' && $array['crop'] == 1 ) $array['min_height'] = 600;
|
||||
|
||||
if ( $array['min_width'] == '' && $array['crop'] == 3 ) $array['min_width'] = 600;
|
||||
if ( $array['min_height'] == '' && $array['crop'] == 3 ) $array['min_height'] = 600;
|
||||
|
||||
if (!isset($array['invalid_image'])) $array['invalid_image'] = "Please upload a valid image!";
|
||||
if (!isset($array['allowed_types'])) {
|
||||
$array['allowed_types'] = "gif,jpg,jpeg,png";
|
||||
|
||||
+3
-3
@@ -92,7 +92,7 @@ class UM_Setup {
|
||||
'_um_profile_template' => 'profile',
|
||||
'_um_profile_max_width' => '1000px',
|
||||
'_um_profile_align' => 'center',
|
||||
'_um_profile_icons' => 'field',
|
||||
'_um_profile_icons' => 'label',
|
||||
'_um_profile_cover_enabled' => 1,
|
||||
'_um_profile_cover_ratio' => '2.7:1',
|
||||
'_um_profile_photosize' => '190px',
|
||||
@@ -117,7 +117,7 @@ class UM_Setup {
|
||||
'_um_register_template' => 'register',
|
||||
'_um_register_max_width' => '450px',
|
||||
'_um_register_align' => 'center',
|
||||
'_um_register_icons' => 'field',
|
||||
'_um_register_icons' => 'label',
|
||||
'_um_register_primary_btn_word' => 'Register',
|
||||
'_um_register_primary_btn_color' => '#3ba1da',
|
||||
'_um_register_primary_btn_hover' => '#44b0ec',
|
||||
@@ -130,7 +130,7 @@ class UM_Setup {
|
||||
'_um_login_template' => 'login',
|
||||
'_um_login_max_width' => '450px',
|
||||
'_um_login_align' => 'center',
|
||||
'_um_login_icons' => 'field',
|
||||
'_um_login_icons' => 'label',
|
||||
'_um_login_primary_btn_word' => 'Login',
|
||||
'_um_login_primary_btn_color' => '#3ba1da',
|
||||
'_um_login_primary_btn_hover' => '#44b0ec',
|
||||
|
||||
Reference in New Issue
Block a user