Skip to content

After image size changing still getting the old size. #20

@danielepennati

Description

@danielepennati

Hello,
I have a custom image size defined in my function.php

add_image_size('home-slider', 1140, 522, true);

I've changed it to be larger

add_image_size('home-slider', 1680, 560, true);

I call this image inside a shorcode using standard wp function wp_get_attachment_image_src:

function cc_srtcd_slider_element($atts, $content = null) {
  extract(shortcode_atts(array(
    "img_url" => '',
    "lazy" => 'true',
    "resize" => 'true'
  ), $atts));
  $content =  do_shortcode( $content );
  $img_id = cc_get_attachment_id_from_src($img_url);
  $img_url = $resize === 'true' ? wp_get_attachment_image_src( $img_id, 'home-slider' ) : wp_get_attachment_image_src($img_id, 'full');
  $html = '<div class="item">';
  if ($lazy == 'true') {
    $html .= '<img class="owl-lazy" data-src="'.$img_url[0].'" />';
  } else {
    $html .= '<img src="'.$img_url[0].'" />';
  }
  $html .= $content.'</div>';
  return $html;
}
add_shortcode("slider_el", "cc_srtcd_slider_element");

After the change of the image size I'm still getting the old one.
If I upload a new image I get the new size but all the previously uploaded picture are not updated to the new dimension.
I've tried to deactivate and reactivate the theme but nothing changed.

I'm making something wrong? Could it be an issue relative to folder and file permission on the server? or is it a plugin bug?

thanks
daniele

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions