Support » Plugins » [Plugin: WP Smart Image II] Determine if custom size exists?

  • Hi and thank you for this wonderful plugin!

    I have integrated it with Max Image Size Control and have it working great.

    I would like to know if there’s a way to check if a custom image size exists before inserting it in my template. I have tried this, on a site where the “custom2” size has never been specified in Max Image Size Control:

    $imgSize2 = get_wpsi('size=custom2');
    if($imgSize2 != "") {
      // code to display it
    } else {
      // code to display thumbnail

    But the check fails and returns the original (very large) size of the image.

    Any ideas on how to get this working would be much appreciated, thank you!

Viewing 1 replies (of 1 total)
  • Hi mmcginnis,

    The next version will bring this feature very improved. You’ll love it 😉

    As you say, we can call the “custom2” size, but still lacks the # setting. So the query implies a little complex array. This is the code i’m using:

    if (class_exists('max_image_size_control')) {
    	$wpsi_misc = get_option('max_image_size_control_data');
    	$wpsi_misc = $wpsi_misc['max_image_size'];
    	foreach($wpsi_misc as $key => $misc) {
    	if($misc['everypost'])  $count += $misc['everypost'];
    		for ( $i = 0; $i <= count($key); $i++ ) {
    			if($misc['custom'][$i]['custom_size_w'] and $count == 1)
    			$formulario .= '
    			<option value="custom'. $i .'">'.__('Setting', 'wp-smart-image').' #'. $key .' &raquo; Custom'.$i.': '.$misc['custom'][$i]['custom_size_w'].' x '.$misc['custom'][$i]['custom_size_h'].'</option>';
Viewing 1 replies (of 1 total)
  • The topic ‘[Plugin: WP Smart Image II] Determine if custom size exists?’ is closed to new replies.