WordPress.org

Support

Support » Plugins and Hacks » [Plugin: Image Widget] Relative paths

[Plugin: Image Widget] Relative paths

Viewing 3 replies - 1 through 3 (of 3 total)
  • Here’s the solution i’ve found.

    Adding

    // Find the base URL
    $baseUrl = get_bloginfo ( ‘siteurl’ );

    // remove the base url and convert to relative path
    $imageurl = str_replace($baseUrl, “”, $imageurl);

    before the original code below

    echo “<img src=\”{$imageurl}\” style=\””;
    if ( !empty( $width ) && is_numeric( $width ) ) {
    echo “max-width: {$width}px;”;
    }

    If you had other solutions don’t hesitate to share.

    Forgot to mention that it was in the plugins/image-widget/views/widget.php

    Thanks for the workaround, tried it but I failed.
    Could you tell me exactly where you are putting your code, thanks.

    <?php
    echo $before_widget;
    if ( !empty( $title ) ) { echo $before_title . $title . $after_title; }
    if ( !empty( $image ) ) {
    	if ( $link ) {
    		echo '<a class="'.$this->widget_options['classname'].'-image-link" href="'.$link.'" target="'.$linktarget.'">';
    	}
    	if ( $imageurl ) {
    			echo "<img src=\"{$imageurl}\" style=\"";
    		if ( !empty( $width ) && is_numeric( $width ) ) {
    			echo "max-width: {$width}px;";
    		}

    Are you inserting it in the curly before
    echo "<img src=\"{$imageurl}\" style=\"";

    Or does anyone else have a solution?

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[Plugin: Image Widget] Relative paths’ is closed to new replies.