Thumb-in-Post Version 0.94

This is a very minor update to my Thumb-in-Post plugin. It corrects a problem that occurs with the Javascript popups in Microsoft Internet Explorer for Windows. Previously the javascript popups didn’t work properly in IE/Win. Otherwise the plugin is exactly the same as before.

The new version can be downloaded here.

The problem wasn’t actually a bug in the plugin but rather it was due to a rather strange behaviour of IE/Win.

In the original javascript code links which should be opened in a popup window were given an attribute rel="popup" and the dimensions of the image (needed so that a popup of the appropriate size could be generated) were stored in a class attribute, like so:

<a href="http://www.website.net/Content/picture.jpg" target="_new" rel="popup" class="320x240" >

The javascript routine retrieved the dimensions from the class attribute using a getAttribute call. Unfortunately, IE apparently sets the class attribute to null immediately after it displays an object. Obviously this causes the script to crash.

The solution is to store the dimensions in the name attribute, like so:

<a href="http://www.website.net/Content/picture.jpg" target="_new" rel="popup" name="320x240" >

In terms of semantic markup, this is probably an abuse of name, but it does work.

22 Comments »

  1. Comment by Chaplin — September 13, 2004 @ 7:19 am

    Thanks for the update!

  2. Comment by Kevin — September 14, 2004 @ 10:31 am

    I’ve recently started using Version 0.7 and it seems to work fine but with this new version when I go to edit the thumb-in-post9.php file it’s corrupt. I’ve included a link to a screen shot of the text so you’ll see what I mean.

    http://kpont.com/tmpimgs/094_text.jpg

    I’m seeing in the zip file when I extract it a couple of __MACOSX files and I’m wondering if something is happening to the zip file causing corruption when I extract it on Windows XP.

    Thanks for this handy plugin.

  3. Comment by Ali — September 14, 2004 @ 11:29 am

    I think it’s not corrupt but that Windows is having difficulty interpreting the line end characters used on Macintosh.

    If you put the plugin in the WordPress plugins directory and view it through the templates page does it still look odd?

  4. Comment by Kevin — September 14, 2004 @ 4:51 pm

    I should have thought of that. Yes it works fine. Thanks.

  5. Comment by Amit — November 7, 2004 @ 9:08 pm

    I have created my own custom css and img folders under my wordpress
    installation. Where would I need to place the .css and .gif files?
    Thanks!

  6. Comment by Amit — November 8, 2004 @ 10:56 am

    Basically, would I need to edit the code to look into my user created folders?
    Hopefully, this isn’t a silly question. I just can’t find a README anywhere
    to answer my own question. Thanks!

  7. Comment by Ali — November 8, 2004 @ 11:06 am

    Amit, you can put the css and gif files anywhere you like. You set the location that the plugin looks for them from the thumb-in-post.cfg file. If you open the file up there are some instructions in there on what to do.

    You can also change the directory that the plugin looks for images in in that file as well.

    Right now there is no README for this since it’s not at version 1.0 yet. If you’re looking for more information I’d suggest you read the entries for the 0.9x versions of the plugin and the associated comments.

  8. Comment by Amit — November 8, 2004 @ 1:55 pm

    Hey, thanks for the reply! I didn’t realize the .cfg file had the answers
    to my questions. Keep up the good work, this looks like a really
    cool plugin.

  9. Comment by Amit — November 9, 2004 @ 2:55 am

    I’m getting the following error even after making all paths verbose:

    Warning: file(http://www.marginalspace.com/wp-content/plugins/thumb-in-post.cfg): failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found in C:\Inetpub\amit\marginalspace\wp-content\plugins\thumb-in-post9.php on line 16

    Warning: Invalid argument supplied for foreach() in C:\Inetpub\amit\marginalspace\wp-content\plugins\thumb-in-post9.php on line 21

    Warning: Cannot modify header information – headers already sent by (output started at C:\Inetpub\amit\marginalspace\wp-content\plugins\thumb-in-post9.php:16) in C:\Inetpub\amit\marginalspace\wp-admin\options.php on line 231

  10. Comment by Ali — November 9, 2004 @ 6:53 pm

    Amit, did you put the thumb-in-post.cfg file in the plugins directory?

  11. Comment by Amit — November 9, 2004 @ 7:04 pm

    Yes, I put both the php and cfg file in the plugins directory.

  12. Comment by Ali — November 9, 2004 @ 10:25 pm

    In that case I’m not sure why it won;t open it. I’m presuming that it may be something to do with permissions not being set to allow the file to be read.

    Your might try making the changes described in comments 7, 8 and 9 on the post for version 0.91. See here.

  13. Comment by kathy — November 13, 2004 @ 6:28 pm

    hi!
    I am having trouble getting the images to pop up eventhough I have this in my settings:
    // If set to ‘true’, javascript popup windows will be used to showed the enlarged picture
    JavascriptPopup == true

    I also checked that the css is in the right place.

    do I need to do anything with this
    // determine what the target window shouold be: _new opens in a new window. Set to target=”_self” to open in the same window
    // Set this to blank if you are using XHTML Strict.
    Target == target=”_new”
    for it to work????

    thanks!

  14. Comment by kathy — November 13, 2004 @ 6:53 pm

    now I have no clue what happened, it was working before, but now, everytime I upload an image I get this error on my bog index page…

    “Warning: Division by zero in /www/htdocs/v109938/blog/wp-content/plugins/thumb-in-post9.php on line 556

    Warning: getimagesize() [function.getimagesize]: Read error! in /www/htdocs/v109938/blog/wp-content/plugins/thumb-in-post9.php on line 172

    Warning: getimagesize() [function.getimagesize]: Read error! in /www/htdocs/v109938/blog/wp-content/plugins/thumb-in-post9.php on line 178

    Warning: Division by zero in /www/htdocs/v109938/blog/wp-content/plugins/thumb-in-post9.php on line 556”

    help??

  15. Comment by Ali — November 14, 2004 @ 12:10 am

    Kathy, the errors in your second post look like they are probably being caused by the plugin being unable to locate the image directory. So you should probably check the settings for that first.

    As far as the javascript popups go, as I’ve said previously, because there are so many different things that might conflict with the javascript code I can’t really provide any support for it. If it works great, go ahead and use it — but otherwise you’re on your own. Sorry.

  16. Comment by forge — December 15, 2004 @ 5:19 am

    I also experienced sudden errors but I figured it out and now fixed.

    Problem was after upgraded from 0.7 to .94 some existing “thumb-Objects” no longer writable and able to read so all I did was went to the cpanel and changed it to 777. Strange process but it did fixed my problem.

    Thank you for sharing this wonderful Plugin. I enjoyed it alot.

  17. Comment by Usayd — January 23, 2005 @ 11:03 am

    Thanks (Jazakallah) for the plugin, i’ll try it out…

  18. Comment by Henrikf — March 31, 2005 @ 7:13 am

    I get this !!

    Warning: getimagesize(/wp-inn/aquarius.jpg): failed to open stream: No such file or directory in /home/hosts/trollpack/www/trollpack.sverok.net/wp-content/plugins/thumb-in-post9.php on line 538

    Warning: Division by zero in /home/hosts/trollpack/www/trollpack.sverok.net/wp-content/plugins/thumb-in-post9.php on line 557

    Warning: getimagesize(/wp-inn/thumb-aquarius.jpg): failed to open stream: No such file or directory in /home/hosts/trollpack/www/trollpack.sverok.net/wp-content/plugins/thumb-in-post9.php on line 173

    Warning: imagecreatetruecolor(): Invalid image dimensions in /home/hosts/trollpack/www/trollpack.sverok.net/wp-content/plugins/thumb-in-post9.php on line 506

    Warning: imagesx(): supplied argument is not a valid Image resource in /home/hosts/trollpack/www/trollpack.sverok.net/wp-content/plugins/thumb-in-post9.php on line 509

    Warning: imagesy(): supplied argument is not a valid Image resource in /home/hosts/trollpack/www/trollpack.sverok.net/wp-content/plugins/thumb-in-post9.php on line 509

    Warning: imagecopyresampled(): supplied argument is not a valid Image resource in /home/hosts/trollpack/www/trollpack.sverok.net/wp-content/plugins/thumb-in-post9.php on line 509

    Warning: imagejpeg(): supplied argument is not a valid Image resource in /home/hosts/trollpack/www/trollpack.sverok.net/wp-content/plugins/thumb-in-post9.php on line 515

    Warning: getimagesize(/wp-inn/thumb-aquarius.jpg): failed to open stream: No such file or directory in /home/hosts/trollpack/www/trollpack.sverok.net/wp-content/plugins/thumb-in-post9.php on line 179

  19. Comment by Henrikf — March 31, 2005 @ 9:11 am

    the thing is that everything is working fine !
    (with the thumbnail and link to full size img)
    But i get the above error message when i load a
    page with the “thumb-in-post” code on.

  20. Comment by Ali — April 3, 2005 @ 9:15 pm

    Henrik, the errors are being produced because the plugin is unable to locate the image file. I’d suggest doeuble-checking that you have the directory set correctly and that the read and write permissions are set appropriately.

    Let me know how you get on,

    Ali

  21. Comment by Henrikf — April 6, 2005 @ 4:45 am

    Hi again !
    i have no luck with changing the file perm. (even to 777)
    You can have a look for your self
    http://trollpack.sverok.net/om-trollpack/styrelse-aktiviteter/
    Password: 5002

    my cfg file
    http://trollpack.sverok.net/wp-inn/thumb-in-post.cfg.txt

    im at loss ??

  22. Comment by Jonathan — October 1, 2006 @ 3:31 am

    Hello, I was wondering whether thumb-in-post was compatible with WP 2.04? It spontaneously stopped working two days ago, and I get the following message:

    Parse error: syntax error, unexpected ‘}’ in /home/platypus3333/public_html/platypus/wp-content/plugins/thumb-in-post9.php on line 28

    Is this common?

    Thanks a lot. Your plugin is excellent- that’s why I want it to work again so badly ^^

Leave a comment

Comments are spam filtered. Your e-mail address will not be displayed. Some HTML tags are allowed.

(required)

(required, but not displayed)