WordPress.org

Ready to get started?Download WordPress

Forums

Image Widget
[resolved] responsive design - image resize? (8 posts)

  1. jannahlyon
    Member
    Posted 2 years ago #

    Not sure if this is a widget problem or a template problem, but is there a way to change the dimensions of the image for a responsive site? Right now all the images in my site get smaller when you reduce the width of the browser because I have a responsive template, but the images inside this widget do not? Any suggestions on how to fix this would be appreciated :)

    http://wordpress.org/extend/plugins/image-widget/

  2. jannahlyon
    Member
    Posted 2 years ago #

    Doh! I just removed the width and height values from the widget .... When you insert an image the width and height fields below are automatically filled in, so just delete those values and leave those fields blank and ta-da responsive images (if your template supports it) ... sorry for the trouble :)

  3. Modern Tribe, Inc.
    Member
    Plugin Author

    Posted 2 years ago #

    Awesome!

    Alternatively, I was going to suggest overriding the template for the widget in your theme.

    See: http://wordpress.org/extend/plugins/image-widget/other_notes/

  4. jimmyw500
    Member
    Posted 1 year ago #

    brilliant thanks for the advice, got it sorted this way too!

  5. eepadmin
    Member
    Posted 1 year ago #

    This first fix (deleting sizes in widget box) is not working for me. My image is displaying but not resizing. How exactly do I override the template? I am not expert in php and need more of a step by step. I realize that there is a parameter for image_widget_image_width that can be disabled. How exactly do you do this?

  6. creacoton
    Member
    Posted 1 year ago #

    I have the same probleme as eepadmin, I would like to know how modify the "image_widget_image_width" to have a max-width = 100%.
    Thank ou for the answer.
    http://www.creacoton.fr

  7. Opally
    Member
    Posted 1 year ago #

    So, do we just add, in our custom widget.php:

    // Block direct requests
    if ( !defined('ABSPATH') )
    	die('-1');
    
    echo $before_widget;
    
    if ( !empty( $title ) ) { echo $before_title . $title . $after_title; }
    
    echo $this->get_image_html( $instance, true );
    
    image_widget_image_width = "100%";
    image_widget_image_height = "auto";
    
    if ( !empty( $description ) ) {
    	echo '<div class="'.$this->widget_options['classname'].'-description" >';
    	echo wpautop( $description );
    	echo "</div>";
    }
    echo $after_widget;
    ?>

    All I found was a "wink" about how to use these parameters to override settings. I'll let you know whether the above code works.

  8. Opally
    Member
    Posted 1 year ago #

    no, that just gives me a parse error.

    Where do we use these nice responsive override parameters?

    Hard code them into the "Custom" settings in widget-admin.php?

    I'll keep mucking around. I don't know why this is set to Resolved. I will open a new support thread on this topic.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic