Aqua-resizer and WMPL together
-
Hi,
I’m using aqua-resizer VER 1.1.7 in my theme and now we added a multilingual support via WMPL plugin.
Everything works fine with my native langauge, but when i select some other language i cant see portfolio featured images and other images like the image url is wrong, it only displays the placeholder.
Default language src:
<img class="ui--content-box-image" src="https://www.indre-reisid.ee/wp-content/uploads/2013/12/mb-sprinter-11-570x321.jpg" alt=""/>
Other language src:
<img class="ui--content-box-image" src="https://www.indre-reisid.ee/wp-content/themes/envision/lib/images/default-placeholder.png" alt=""/>
So the problem is when i’m using another langauge aqua-resizer can’t give me back my image and theme chooses placholder.
So here’s the line in aqua-resizer script :
// Check if $img_url is local. if ( false === strpos( $url, $upload_url ) ) return false; And that's why it returnes no image. I looked a bit, and found this solution in wmpl forum, but it worked with earlier verison of aqua reziser when they used home_url instead of upload_url : $home_url = home_url(); if(strpos($home_url, '?lang') !== false) { $home_url_parts = explode ('?', $home_url); $home_url = $home_url_parts[0]; } When i changed the home_url to upload_url in this part, it crashes. Maybe bcz somethin in this part of script : function aq_resize( $url, $width = null, $height = null, $crop = null, $single = true, $upscale = false, $retina = false ) { // Validate inputs. if ( ! $url || ( ! $width && ! $height ) ) return false; // Retina size $retina = $retina ? 2 : 1; $width = $width * $retina; $height = $height * $retina; // Caipt'n, ready to hook. if ( true === $upscale ) add_filter( 'image_resize_dimensions', 'aq_upscale', 10, 6 ); // Define upload path & dir. $upload_info = wp_upload_dir(); $upload_dir = $upload_info['basedir']; $upload_url = $upload_info['baseurl']; $http_prefix = "https://"; $https_prefix = "https://"; /* if the $url scheme differs from $upload_url scheme, make them match if the schemes differe, images don't show up. */ if(!strncmp($url,$https_prefix,strlen($https_prefix))){ //if url begins with https:// make $upload_url begin with https:// as well $upload_url = str_replace($http_prefix,$https_prefix,$upload_url); } elseif(!strncmp($url,$http_prefix,strlen($http_prefix))){ //if url begins with https:// make $upload_url begin with https:// as well $upload_url = str_replace($https_prefix,$http_prefix,$upload_url); }
[Moderator Note: Please post code & markup between backticks or use the code button. Your posted code may now have been permanently damaged by the forum’s parser.]
Any help?
[Moderator Note: No bumping. If it’s so urgent that you cannot wait longer than 30 minutes, consider hiring someone.]
- The topic ‘Aqua-resizer and WMPL together’ is closed to new replies.