Remove WordPress auto cropping images completely -
i making custom theme , have site pretty done. using types custom fields use upload images later put carousel. finding when upload image 1069x1060 not cropped or touched , whole content of image visible. when upload picture 850x700 image gets cropped , whole area not visible
this can seen @ http://blog.jmrowe.com/portfolio rotating pictures , you'll notice 1 cropped , unable see whole content.
also, unchecked option "crop thumbnail exact dimensions (normally thumbnails proportional)" under settings -> media , did not help. did not add custom feature image sizes.
what's weird when select image shows in tiny preview screen image un-cropped. however, when site visited image cropped. selected use "full size"
can please help?
i using types custom fields plugin show these in theme like:
<?php if (!((get_post_meta($post->id, 'wpcf-portfoliopicture1', true))=='')): ?> <div class="row"> <div class="span8"> <div class="span6 offset1" style="padding-left:20px;"> <?php $param['height']=350; $param['width']=325; $param['alt']=types_render_field("portfoliotitle1",$param2); $param['title']=types_render_field("portfoliotitle1",$param2); ?> <ul class="round"> <li><?php echo(types_render_field("portfoliopicture1", $param)); ?></li> <?php $param['alt']=types_render_field("portfoliotitle2",$param2); $param['title']=types_render_field("portfoliotitle2",$param2); ?> <li><?php echo(types_render_field("portfoliopicture2", $param)); ?></li> <?php $param['alt']=types_render_field("portfoliotitle3",$param2); $param['title']=types_render_field("portfoliotitle3",$param2); ?> <li><?php echo(types_render_field("portfoliopicture3", $param)); ?></li> </ul> </div> </div> </div> <?php endif; ?>
i notice if go wp-includes/media.php , goto function image_resize_dimensions
that can edit out of function , won't auto-crop images..however, not resize them either picture natively 1000px x 900px that
i pretty sure problem lies in wp-includes\media.php function below:
function image_resize_dimensions($orig_w, $orig_h, $dest_w, $dest_h, $crop = false) { if ($orig_w <= 0 || $orig_h <= 0) return false; // @ least 1 of dest_w or dest_h must specific if ($dest_w <= 0 && $dest_h <= 0) return false; // plugins can use provide custom resize dimensions $output = apply_filters( 'image_resize_dimensions', null, $orig_w, $orig_h, $dest_w, $dest_h, $crop ); if ( null !== $output ) return $output; if ( $crop ) { // crop largest possible portion of original image can size $dest_w x $dest_h $aspect_ratio = $orig_w / $orig_h; $new_w = min($dest_w, $orig_w); $new_h = min($dest_h, $orig_h); if ( !$new_w ) { $new_w = intval($new_h * $aspect_ratio); } if ( !$new_h ) { $new_h = intval($new_w / $aspect_ratio); } $size_ratio = max($new_w / $orig_w, $new_h / $orig_h); $crop_w = round($new_w / $size_ratio); $crop_h = round($new_h / $size_ratio); $s_x = floor( ($orig_w - $crop_w) / 2 ); $s_y = floor( ($orig_h - $crop_h) / 2 ); } else { // don't crop, resize using $dest_w x $dest_h maximum bounding box $crop_w = $orig_w; $crop_h = $orig_h; $s_x = 0; $s_y = 0; list( $new_w, $new_h ) = wp_constrain_dimensions( $orig_w, $orig_h, $dest_w, $dest_h ); } // if resulting image same size or larger don't want resize if ( $new_w >= $orig_w && $new_h >= $orig_h ) return false; // return array matches parameters imagecopyresampled() // int dst_x, int dst_y, int src_x, int src_y, int dst_w, int dst_h, int src_w, int src_h return array( 0, 0, (int) $s_x, (int) $s_y, (int) $new_w, (int) $new_h, (int) $crop_w, (int) $crop_h ); }
i know shouldn't mess core files when effects problem can not figure out fix it. function called plugin ( types - custom types , fields ) , cropping happening
i dl'ed , ran through files. grabbing 1 wrong image size despite correct code (confirmed instructions @ includes/fields/image.php)
you play around customizing plugin bit. i've found wp_handle_upload override upload process.
if ( ! function_exists( 'wp_handle_upload' ) ) require_once( abspath . 'wp-admin/includes/file.php' ); $uploadedfile = $_files['file']; $upload_overrides = array( 'test_form' => false ); $movefile = wp_handle_upload( $uploadedfile, $upload_overrides ); if ( $movefile ) { echo "file valid, , uploaded.\n"; var_dump( $movefile); } else { echo "possible file upload attack!\n"; }
other have speak dev issue. can't find else without being logged site. :) hope best, i'll watching page.
Comments
Post a Comment