timthumb

functions.php

/* ===============================================
# timthumb
=============================================== */

define('THEME_DIR', get_template_directory_uri());
/* Timthumb CropCropimg */
function thumbCrop($img='', $w=false, $h=false , $zc=1, $a=false, $cc=false ){
    if($h)
        $h = "&h=$h";
    else
        $h = "";

    if($w)
        $w = "&w=$w";
    else
        $w = "";
	if($a)
        $a = "&a=$a";
    else
        $a = "";
	if($cc)
        $cc = "&cc=$cc";
    else
        $cc = "";

    $img = str_replace(get_bloginfo('url'), '', $img);
     $image_url = str_replace("http://","http://",THEME_DIR) . "/timthumb/timthumb.php?src=" . $img . $h . $w. "&zc=".$zc .$a .$cc;
    return $image_url;

}

HTML

<?php
						if (has_post_thumbnail()) {
							$image_url1 = get_the_post_thumbnail_url( get_the_ID(),'large');
							$image_url2 = get_template_directory_uri() . '/timthumb/timthumb.php?src=' . $image_url1 .'&amp;h=400' . '&amp;w=660';
							?>
							<img src="<?php echo $image_url2; ?>">
						<?php } else { ?>
							<img src="https://placehold.jp/eeeeee/ffffff/660x400.png?text=No%20photo" alt="">
						<?php
						}
						?>