WordPress.org

Ready to get started?Download WordPress

Forums

Contextual Related Posts
[resolved] timthumb not working at all (15 posts)

  1. bjaspray
    Member
    Posted 11 months ago #

    Hi,

    My thumbnails are all showing up as broken images. When I go to the URL generated - here - it says "A TimThumb error has occured: Could not get a lock for writing."

    But I have other plugins which seem to be able to generate thumbnails fine. Can you advise?

    http://wordpress.org/plugins/contextual-related-posts/

  2. Ajay
    Member
    Plugin Author

    Posted 11 months ago #

    I'm not sure of the exact reason, but I've searched the web for some possible solutions to this:

    1. Check permissions on your cache directory in the timthumb folder. Should be writable by the script so either 755 or 777

    2. http://www.yunomie.com/2438/timthumb-lock-for-writing-error/

  3. bjaspray
    Member
    Posted 11 months ago #

    Thanks for looking into this for me. I'm afraid the above doesn't seem to have worked. I'm looking into reasons the php command flock() may fail but I haven't found anything yet. I'll keep investigating but if you think of any other possible reasons then please let me know.

  4. Ajay
    Member
    Plugin Author

    Posted 11 months ago #

    Is it possible to ask your host if there are any permission related issues in the use of this command?

    Do you have any other plugin / theme that you know uses timthumb?

  5. bjaspray
    Member
    Posted 11 months ago #

    I asked my server host about it and he asked for permission to edit timthumb.php, whereupon he confidently commented out the flock() command and its catch statements and informed me that timthumb now worked. (I just found this out by doing a diff on the files)

    I'm not sure what to make of this. I assume he's saying that you don't really need to lock the image before editing it, but in my mind that doesn't count as a solution. What I wanted him to do was make flock() work or explain why it didn't work.

    But for now, timthumb does appear to be working.

  6. Ajay
    Member
    Plugin Author

    Posted 11 months ago #

    I agree with you on flock needing to work. Is there a reason he says that he commented out flock()?

    The issue is you'll need to keep replicating this everytime you update this plugin or any other plugin / theme that uses timthumb or maybe wider if it uses flock()

  7. bjaspray
    Member
    Posted 11 months ago #

    I've asked him about this and I'll let you know what he says.

  8. bjaspray
    Member
    Posted 11 months ago #

    He says we just can't use the flock() function on our server. Pretty annoying!

  9. Ajay
    Member
    Plugin Author

    Posted 11 months ago #

    Unfortunately, you'll be stuck on that one as long as you host with them.

    The way timthumb is activated in the plugin is on line 625

    https://plugins.trac.wordpress.org/browser/contextual-related-posts/trunk/contextual-related-posts.php#L625

    I'm not sure how familiar you are with PHP, but you could potentially

    1. Create your own flock() free timthumb.php or any other thumbnailing script

    2. Remove the existing filter:

    remove_filter('crp_postimage', 'crp_scale_thumbs');

    3. Write your own function in your themes function.php along those from line 625

  10. Kiseki Studio
    Member
    Posted 11 months ago #

    I had a very similar issue to this, it was related to the group/owner and permissions set on the timthumb folder, not related to flock(). I changed the folder owner to one with more privileges and this solved the problem for me.

    Hope that helps anyone else having similar issues in future.

  11. Ajay
    Member
    Plugin Author

    Posted 11 months ago #

    Thank you Kiseki for the update :)

  12. Silvanovicz
    Member
    Posted 9 months ago #

    hmmm... I'm having the same lock issue.

    However, when I first added the plugin, it worked fine, but then after a few days, some images didn't show up (but some did; probably because they were cached). Here's one page:

    http://www.popsirens.com/listen-katy-perrys-2nd-single-prism-unconditionally/

    So does that point to the issue with folder permissions, or is it something else?

  13. Ajay
    Member
    Plugin Author

    Posted 9 months ago #

    Silvanovicz, I can see all the images in your "You may also like" section

  14. Silvanovicz
    Member
    Posted 9 months ago #

    I've decided to turn TinThumb off, seeing as it was picking a size that was quite close anyway.

  15. Ajay
    Member
    Plugin Author

    Posted 9 months ago #

    I understand. Unfortunately, it's most likely a permission issue with flock

Reply

You must log in to post.

About this Plugin

About this Topic