MorpheusUK
Forum Replies Created
-
Forum: Plugins
In reply to: [Easy Appointments] Calendar for specific service not workingI worked out what was wrong, the order of the parameters matters, They need to be in this order:-
[ea_bootstrap worker=”1″ service=”1″ location=”1″]
Once the order was changed it worked as expected
Forum: Plugins
In reply to: [Simple Social Page Widget & Shortcode] error activating pluginHi,
I’m running PHP 7.2 with 1.6.0 on WP 5.0.2 and it activated fine. Only problem i have is that the widget isn’t displaying anything other than the header whether I use my page or the default facebook one.
HTH
Hi jbd7,
Really just to keep you in the loop as whatever I come up with may prove useful to you, I haven’t had a huge amount of time to play with this further but have had another go today, the test function is below:
function responsify_flickr($content) { $content = preg_replace('/<img(.*title=\"(.*)\")(.*src=\"(.*staticflickr\.com.*)(_.*)\.jpg\")(.*alt=\"(.*)\")(.*)height=\"(\d+)\"(.*)width=\"(\d+)\"(.*)>/i', '<img src="$4_o.jpg" srcset="$4_n.jpg 320w, $4.jpg 500w, $4_z.jpg 640w, $4_c.jpg 800w, $4_b.jpg 1024w, $4_h.jpg 1600w, $4_k.jpg 2048w" title="$2" alt="$7" width="100%" height="$9"/>', $content , -1); return $content; } add_filter( 'the_content', 'responsify_flickr' );
I used the function above which covers all the main resolution categories from Flickr sometimes with multiple values. This wont work as the base filenames change for some of the resolutions. On one example I have been looking at they seem consistent between 320 and 1024 but the original filename and larger sizes have different bases. This means that depending on which image size you selected when adding the image will determine whether the function will work at all. If you picked the original image size (denoted with “_o” in flickr) then it will fail. Same if you had picked one above 1024 wide.
I think the way to solve this so that it works in all situations is to change the insertImage function in the wp-flickr-embed.js file of the plugin to get a list of image names for each size and add the srcset attribute there.
I think it should be possible to get the url data when the callbackPhotoSizes method is called and either build up the srcset tag whilst it is processing the list and store it or store the returned list and build it up in the insertImage function.
Unfortunately I don’t have time to try this now or a suitable WordPress development environment to test it as I wouldn’t want to do that on the live site so it will have to wait until I next get some free time to play with this.
I’ll also post this on the github page in case anyone takes an interest.
Morpheus
Okay just tried the following which breaks a different set of images:
function responsify_flickr($content) { $content = preg_replace('/<img(.*src=\"(.*staticflickr\.com.*)(_.*)\.jpg\")(.*)height=\"(\d+)\"(.*)width=\"(\d+)\"(.*)>/i', '<img$1 srcset="$2_n.jpg 320w, $2.jpg 500w, $2_b.jpg 1024w"$4 width="100%" height=\"$5\" width=\"$7\"/>', $content , -1); return $content; } add_filter( 'the_content', 'responsify_flickr' );
I don’t think the regex can be this universal, maybe the content needs to undergo multiple filters? At present trying to implement this is breaking some of the images (the static ones are from this plugin)
I’ve been trying this filter on this and the subsequent pages: https://www.birminghamshotokan.com/news-2/latest-bhskc/
Okay I have been playing around with the regex and i think it should be something like:
<img(.*src=\"(.*staticflickr\.com.*)(_.*)\.jpg\")(.*)height=\"(\d+)\"(.*)width=\"(\d+)\"(.*)>
However I’m not sure what $5 and $7 were supposed to be doing in the replacement string of your original, they map to the width and heigh values I think.
The one I have created above breaks down as follows with the URL in my previous post
1. [4-172]
style="width: 480px; height: 640px;" title="Staffordshire International Karate Championship 2015" src="https://farm8.staticflickr.com/7774/17501816105_0acbc2aa26_z.jpg"
2. [108-165]https://farm8.staticflickr.com/7774/17501816105_0acbc2aa26
3. [165-167]_z
4. [172-232]alt="Staffordshire International Karate Championship 2015"
5. [240-243]640
6. [244-245]
7. [252-255]480
8. [256-256]Hi JB,
Okay just gave that a try using various caption removal options in that thread and without them and just your function and in many cases for me this seems to result in a white box saying image is no longer available (which it is). Removing the responsify_flickr function fixes this.
Any ideas,
What’s going wrong, sorry, I’m more of a Java, C++ guy and don’t really know PHP.
An example of one of the image URLs that breaks is:
<img style="width: 480px; height: 640px;" title="Staffordshire International Karate Championship 2015" src="https://farm8.staticflickr.com/7774/17501816105_0acbc2aa26_z.jpg" alt="Staffordshire International Karate Championship 2015" height="640" width="480"></img>
Cheers
Hi jb,
I’ve been a bit busy recently so haven’t had much time to work on the site but will give that a try.
Thanks,
Morpheus
Forum: Plugins
In reply to: [WP Theater] Problems with browsers and playlist displayHi Kentfarst,
I’m afraid I spoke too soon (something seems to be caching stuff for a long period which affects some devices more than others). I have had to disable the referrer again as sure enough after a while the videos weren’t available on any platform (I tried from my work machine today just to rule out anything local on my network).
So assuming that the plugin isn’t affecting/populating the referrer in anyway I suspect this is an issue on the google side. Although I didn’t see anyway to find this on first glance it would be useful to know what URLs google think the requests are coming from.
If I work out anything I’ll let you know.
Morpheus
Forum: Plugins
In reply to: [WP Theater] Problems with browsers and playlist displayHi kentfarst,
Well reinstated the domain filter and it at least seems to be working (on mobile browsers) the desktop browsers aren’t showing the gallery at the moment but I’m convinced it must be something I’m running (possible some security software as it affects all browsers).Forum: Plugins
In reply to: [WP Theater] Problems with browsers and playlist displayThanks Kentfarst,
I think the problem was actually a result of the valid referrers and odd browser caching problems (I’d disabled the site caching plugin whilst trying to diagnose the issue). When the referrers were set to the domain or even the specific page was when it didn’t seem to display (mostly), not really sure why the user agent seemed to make a difference and clearing out my browser cache wasn’t always effective but I know the ISP uses a transparent cache so that may have factored in.I’ve disabled the allowed referrers for the moment for the key and it now seems to be working, not ideal from a security standpoint but better than a page without any content apart from the text I put before the shortcode.
Anyway thanks for writing the plugin, I was looking for a replacement to the free tubepress which stopped working with the API update and the new version was severely crippled. This does 90% of what I used to use only missing the paging instead of a link to our YouTube channel for more videos. Also thanks for the quick response I was completely baffled yesterday by the inconsistent behaviour and as nobody else seemed to have mentioned it figured it must be specific to my setup as it was across all the major browsers.
Thanks again,
Morpheus