Good work, as always rares! Thank you.. though it seems chasing after scribd to hand over decent thumbs is truly a tough job, and possibly an insurmountable one.
I just installed rc8, and was pleased to see it fixed most of my missing or bad thumbnails, except for one.. which refuses to load anything but a PDF logo.
After some code browsing it looks like you've tried to head off icon saving at a number of paths, unfortunately waiting some amount of time for the logo doesn't seem to be enough for some documents. Most of the documents I work with are large PDFs that almost never finish before the "your document is taking unusually long to convert" warning appears, and all of my browsing interfaces are driven by the cover image thumbnails.
Maybe some sort of check to ensure that the thumbnail image size is greater than 32x32 pixels?
Thanks again!
Comments
Comment #1
rares commentedI agree. Maybe you know some functions to check for that and could suggest a patch.
In the meantime the easiest thing is to increase the timeout from the PHP code.
An interesting thing to research is if the thumbnail links that Scribd gives stay the same or not. At least, like, over a one-day period. Then the module might be changed to fetch just thumbnail URLs(maybe on cron runs). If that is viable then it would have to come as a patch from you guys, because I don't have any more time to rewrite code.
Comment #2
rares commentedI've added committed a version (you can try the 6.x-dev dated today) that does an extra check for the conversion status before getting the thumbnail. So even if two minutes have passed since the save, it will still not get the thumbnail unless it has successfully converted.
Does this eliminate the problem?
Comment #3
techninja commentedWonderful! Thank you for the quick work and incredible diligence rares!
I tried the dev version on one of my problem sites, and it fixed a number of dead images! Unfortunately, for the second site, I still got a PDF icon. I may be forced to have a PDF icon with this specific PDF, though I might prefer the empty image. Here's some example code to check the image size:
This fits reasonably well after line 918 on the dev version of ipaper.module. The real trick is what to do once you know it's an icon.. Delete it? Assume it's not ready? I have a feeling my problem ipaper node will never return anything other than the pdf icon, as that is ALL it shows for a preview on the ipaper website...
Apparently scribd's pdf support is a little sketchy, or my PDFs are a little sketchy.. I wouldn't doubt either.
Anyways, thanks again rares. The above code is a start but what to do from there I'm not too sure.
Comment #4
rares commentedin the dev version, where it says
after that, add your code
let me know if it works.
Comment #5
techninja commented$destination isn't actually set until a number of lines further on.. and after some thought, the real intent here is to check the size of the file we INTEND to save.. not a probable bad one that we've already saved locally. So I modified the code to check the ipaper source image right after line 917 of the dev module
This unfortunately failed, probably from some inability of the PHP on my server to properly check the size remote image. Back to the original idea of actually checking the downloaded image, $destination. Around line # 921 of the dev module, I was able to add the size checking code, but.. in it's current form, it simply exists from the function without doing anything, and this is of almost no use as only one of the four calls to _ipaper_save_thumb() even care if it returns true or false/null.
So, my only other option at this point would be to delete the $destination image once we found out it was and icon, send a message to the user and/or watchdog, then.. done? Here's my example code...
From ~ line # 918 of the dev module
I've tested this and it does in fact keep ipaper from giving the document an icon.
What to do after that? Not sure... because it deletes the bad file, on every thumbnail_theme attempt it will try and grab a new one, so this would seemingly guarantee the thumbnail be updated as soon as one is available, unfortunatly for me and my bad PDF, this means my code would fill up my watchdog queue with ipaper warnings.. Though it is my problem to solve with Scribd.
Look this over rares, and thank you again for the hard work!