Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

image resize not working on multisite #1469

Closed
geoffmuskett opened this issue Jun 29, 2017 · 5 comments
Closed

image resize not working on multisite #1469

geoffmuskett opened this issue Jun 29, 2017 · 5 comments

Comments

@geoffmuskett
Copy link

My uploads structure is: uploads > sites > 6 > 2017 > 06

Expected behavior

Create the cropped image at the size defined

Actual behavior

getting error message:

Fatal error: Uncaught Error: Call to undefined method Timber\TextHelper::starts_with() in /Users/geoffmuskett/Desktop/WEBSITES/KAW/wordpress/wp-content/plugins/timber-library/lib/ImageHelper.php:345 Stack trace: #0 /Users/geoffmuskett/Desktop/WEBSITES/KAW/wordpress/wp-content/plugins/timber-library/lib/ImageHelper.php(503): Timber\ImageHelper::analyze_url('http://swknotwe...') #1 /Users/geoffmuskett/Desktop/WEBSITES/KAW/wordpress/wp-content/plugins/timber-library/lib/ImageHelper.php(66): Timber\ImageHelper::_operate('http://swknotwe...', Object(Timber\Image\Operation\Resize), false) #2 /Users/geoffmuskett/Desktop/WEBSITES/KAW/wordpress/wp-content/plugins/timber-libraryV1/vendor/twig/twig/lib/Twig/Environment.php(462) : eval()'d code(38): Timber\ImageHelper::resize('http://swknotwe...', 500, 300) #3 /Users/geoffmuskett/Desktop/WEBSITES/KAW/wordpress/wp-content/plugins/timber-libraryV1/vendor/twig/twig/lib/Twig/Template.php(432): __TwigTemplate_01952c590143aba25a054a58109e75508afcea146a808c3a14647aae759cba27->doDisplay(Arra in /Users/geoffmuskett/Desktop/WEBSITES/KAW/wordpress/wp-content/plugins/timber-library/lib/ImageHelper.php on line 345

Steps to reproduce behavior

The image is within a Flexible Content area, here's whats in page.php:

`while ( have_rows('section_type') ) : the_row();

    if( get_row_layout() == 'header' ):
        $section_content[] = [
            'background_image'  => new TimberImage(get_sub_field('background_image_background_image')),
        ];
    endif;

endwhile;

else :

// no layouts found

endif;

$context['section_content'] = $section_content;`

then in the template:

{{the_section.background_image.src|resize(600, 600)}}

What version of WordPress, PHP and Timber are you using?

WordPress 4.8, PHP 7.0.15, Timber 1.2.4

How did you install Timber? (for example, from GitHub, Composer/Packagist, WP.org?)

Downloaded from wp.org

@geoffmuskett
Copy link
Author

Unless I'm missing something, I don't think the php is affecting it, it seems that any template TimberImage resize causes an error...

@sulli-a
Copy link

sulli-a commented Aug 18, 2017

I have the same problem without multisite

<img src="{{post.thumbnail.src|resize(380, 185)}}" alt="">

causes PHP Fatal error :

Fatal error: Call to undefined method Timber\TextHelper::starts_with()

With WordPress 4.8.1, PHP 5.6.30, Timber 1.4.1

@sulli-a
Copy link

sulli-a commented Aug 22, 2017

Resolved !

Cause 2x installed in same project, (plugins, and composer)

@ereinach
Copy link

Resolved !

Cause 2x installed in same project, (plugins, and composer)

That's it. Timber was installed twice as well.

@gchtr
Copy link
Member

gchtr commented May 3, 2023

Great you resolved the issue 👍

@gchtr gchtr closed this as completed May 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants