I'd appriciate Your help. I made use of custom area in Wordpress and produced the shape to upload the look within the publish. Everything works fine. I additionally placed this code to exchange the initial image ( if a person published huge image size ) which instantly resizes it. It actually resizes the look however it does not keep your aspect ratio meaning max 500px width, max 800px height. It requires that walues and becomes croped to that particular size. I would like the peak to become proportional not croped! it goes to functions.php

function replace_uploaded_image($image_data) {
// if there is no large image : return
if (!isset($image_data['sizes']['large'])) return $image_data;

// paths to the uploaded image and the large image
$upload_dir = wp_upload_dir();
$uploaded_image_location = $upload_dir['basedir'] . '/' .$image_data['file'];
$large_image_location = $upload_dir['path'] . '/'.$image_data['sizes']['large']  

// delete the uploaded image

// rename the large image

// update image metadata and return them
$image_data['width'] = $image_data['sizes']['large']['width'];
$image_data['height'] = $image_data['sizes']['large']['height'];

return $image_data;


Correct me if I am wrong, however, you appear to become spinning a function that already is available in Wordpress - http://codex.wordpress.org/Function_Reference/add_image_size