Page 1 of 3

Larger Dilbert image plugin

Posted: 17 Apr 2013, 18:00
by amha
Due to change in the dilbert feed, this plugin is now obsolete. However fox made a nice plugin that will solve this inconvenience : af_dilbert, which comes with tt-rss since 1.9.



Replace smaller (print) version with the largest (zoom) version of the Dilbert Daily Strip.
I used to have a Greasemonkey script to do that, but I find it better handled by TT-RSS.
Enjoy!

Re: Larger Dilbert image plugin

Posted: 19 Apr 2013, 16:42
by amha
Version 1.01: remove $link for compliance with TT-RSS version 1.7.9 (works with 1.7.8 too).

Re: Larger Dilbert image plugin

Posted: 19 Apr 2013, 19:05
by jmozmoz
I unzip the archive in the plugins directory but the plugin does not show up in the preferences (github HEAD version of tt-rss): This is in the sytem/log window:

Code: Select all

E_USER_WARNING (512)   classes/pluginhost.php:139   Plugin dilbert_large is not compatible with current API version (need: 2, got: 1)

You have to add

Code: Select all

        function api_version() {
                return 2;
        }

Re: Larger Dilbert image plugin

Posted: 19 Apr 2013, 19:25
by amha
Thank you for pointing that out. As I'm currently using the stable 1.7.8 I didn't catch that.

Version 1.02: added api_version().

Re: Larger Dilbert image plugin

Posted: 19 Apr 2013, 23:38
by Napkin
It's not working for me, I think: The image from April 19th, 2013 has a size of 560x174 when looked at in the reader. Looking at the website the image is 640x199.

Is it maybe caused by the fact that I configured the feed to "Cache images locally"?

Re: Larger Dilbert image plugin

Posted: 20 Apr 2013, 00:57
by Rundfunk
As an avid Dilbert reader, I applaud this plugin. However, it also does not work for me. (I'm using the official Dilbert RSS feed btw)

I get the following image in my TT-RSS: http://dilbert.com/dyn/str_strip/000000 ... .strip.gif , while the bigger image can be found at: http://dilbert.com/dyn/str_strip/000000 ... p.zoom.gif

Re: Larger Dilbert image plugin

Posted: 20 Apr 2013, 01:17
by craywolf
Until the author provides a fix, you can open up init.php and replace this line:

Code: Select all

      $article['content'] = str_replace('.strip.print.gif', '.strip.gif', $article['content']);


With this:

Code: Select all

      $article['content'] = str_replace('.strip.print.gif', '.strip.zoom.gif', $article['content']);


It looks like strip.gif is in fact bigger than strip.print.gif but not by a lot. The zoom version is plenty big.

Re: Larger Dilbert image plugin

Posted: 20 Apr 2013, 10:08
by amha
For years I was only getting the average size pictures… Thanks!

Version 1.03: even bigger Dilbert.

Re: Larger Dilbert image plugin

Posted: 20 Apr 2013, 12:03
by amha
Version 1.04: tiny modification to the description.

No need to update if you're using 1.03.

Re: Larger Dilbert image plugin

Posted: 20 Apr 2013, 13:10
by Napkin
Hmm, I'm wondering how this works for you guys? Maybe we're using different feeds? On dilbert.com when I click "RSS" and choose "Strips" I'm offered this feed: http://feed.dilbert.com/dilbert/daily_strip?format=xml

I looked at the articles in the ttrss SQL database and none of Dilbert's articles had the string "DilbertDailyStrip" in it's link attribute - as searched for in hook_render_article_cdm(). My articles of Dilbert have something like this:

Code: Select all

http://feed.dilbert.com/~r/dilbert/daily_strip/~3/qe5dKS2UpTw/

I changed the plugin as below (and disable caching of the images locally) to make it work here.

Code: Select all

--- /usr/local/src/tt-rss/dilbert_large/init.php   2013-04-20 10:00:36.000000000 +0200
+++ init.php   2013-04-20 10:49:49.831741467 +0200
@@ -35,7 +35,7 @@
   }
 
   function hook_render_article_cdm($article) {
-    if (strpos($article['link'], 'DilbertDailyStrip') !== FALSE) {
+    if (strpos($article['link'], 'feed.dilbert.com') !== FALSE) {
       $article['content'] = str_replace('.strip.print.gif', '.strip.zoom.gif', $article['content']);
     }
     return $article;

Re: Larger Dilbert image plugin

Posted: 20 Apr 2013, 20:28
by amha
@Napkin

You're right. I'm not using the official feed directly but the one from feedburner, provided years ago by dilbert.com.

The feeds urls:

Code: Select all

http://feed.dilbert.com/dilbert/daily_strip

Code: Select all

http://feeds.feedburner.com/DilbertDailyStrip


The links:

Code: Select all

http://feed.dilbert.com/~r/dilbert/daily_strip/~3/qe5dKS2UpTw/

Code: Select all

http://feedproxy.google.com/~r/DilbertDailyStrip/~3/qe5dKS2UpTw/


If everyone is confortable with it I propose a simple:

Code: Select all

if (strpos($article['link'], 'DilbertDailyStrip') !== FALSE || strpos($article['link'], 'dilbert/daily_strip') !== FALSE)

Re: Larger Dilbert image plugin

Posted: 20 Apr 2013, 20:39
by amha
Version 1.05: handle both the official feed and the feedburner one.

Re: Larger Dilbert image plugin

Posted: 21 Apr 2013, 12:44
by Napkin
Ah, great, thank you!

Re: Larger Dilbert image plugin

Posted: 24 Apr 2013, 11:38
by entaled
Using this feed:

Code: Select all

http://feed.dilbert.com/dilbert/daily_strip

which I believe is the listed official feed, the images were not being replaced. I dug into the db and my 'link' entries look like this:

Code: Select all

http://dilbert.com/strips/comic/2013-04-24/

so I replaced

Code: Select all

if (strpos($article['link'], 'DilbertDailyStrip') !== FALSE || strpos($article['link'], 'dilbert/daily_strip') !== FALSE) {

with

Code: Select all

if (strpos($article['link'], 'DilbertDailyStrip') !== FALSE || strpos($article['link'], 'dilbert') !== FALSE) {

which I know isn't likely the best or most robust solution, but it's working for me. It could be some other plugin changing the links, I tried disabling af_unburn but that didn't change anything. I'm not sure what's doing it.

Re: Larger Dilbert image plugin

Posted: 24 Apr 2013, 15:02
by amha
Hi entaled,

I'm quite surprised. Looking at the feed itself I can see 3 values that could be interpreted as link:

Code: Select all

<link>http://feed.dilbert.com/~r/dilbert/daily_strip/~3/0yECkz9IKd8/</link>
<guid isPermaLink="false"><![CDATA[http://dilbert.com/strips/comic/2013-04-24/]]></guid>
<feedburner:origLink>http://dilbert.com/strips/comic/2013-04-24/</feedburner:origLink>


I thought the first one was the one. I tried to add this feed but it seems it mixed with the one I already have.
I deleted both from my feeds list and I'll see tomorow how it goes.