syamilmj / Aqua-Resizer

Resize WordPress images on the fly
502 stars 208 forks source link

Tried adding the php page in my website but still facing the same problem #55

Open ajai-jayakumar opened 9 years ago

ajai-jayakumar commented 9 years ago

Hii am running an entertainment website where am using wp theme , the problem is I cant see my website index page in a mobile view . I tried every browser and app but still the same problem but i can view my inner pages of my website in mobile view ..

My error is " Fatal error: Call to undefined function aq_resize() in /home/ajaisandy/public_html/wp-content/plugins/js_composer/composer/lib/shortcodes/home_column_posts.php on line 223"

hence I place your aq resize php file inside "/home/ajaisandy/public_html/wp-content/plugins/js_composer/composer/lib/shortcodes/" but am still facing the same prob .. any solution . thanks in advance

emanuelpoletto commented 9 years ago

I don't know this plugin that you're using js_composer. But I think the problem there may be that plugins are loaded before your functions.php file. And aq_resize is intended to be called in your functions.php that is loaded afterwards.

Does this make sense?

If so, you can just wrap up the block of code on line 223 of the file that you said above with an if statement like this:

if ( function_exists( 'aq_resize' ) ) {
    // line 223... until... some code...
}

This is supposed to solve the homepage problem. Caveat: If that plugin uses the function aq_resize, you have to call this function before, anyway.

I hope it can help. Let me know if this is the problem and how you solved it. :wink:

ajai-jayakumar commented 9 years ago

Tried Mr.emanuelpoletto but am still getting the same error without the change in line i.e 223

this is the code that exists on line 223 "$image = aq_resize( $thumbnailSrc, 900, 'auto', false);"

emanuelpoletto commented 9 years ago

Ok, @ajai-sandy Then, I would try adding the following right before line 223:

if ( ! function_exists( 'aq_resize' ) ) {
    require_once( get_template_directory() . '/SOME-FOLDER/aq_rezise.php' );
}

Change or exclude the SOME-FOLDER dirname according to your aq_resize.php file path.

ajai-jayakumar commented 9 years ago

Hi @emanuelpoletto am sorry for the late reply , I have tried the above code and I got the issues in excluding the dirname and tried few possibilites , but still I cant resolve the issue ..