Alt to Legend (v0.50)

This is a neat Plugin!Installation.
Simply download the plugin, unzip it and copy the php file in the plugin directory of your wordpress installation. Then activate it from the admin panel. You can customize the behavior of Alt-2-Legend from a new panel that will appear under the ‘Option’ page in the admin panel.

How to use.
Once your plugin is installed, it is ready to use. Simply insert an image in your post as you normally do and provide a description in the title textbox of the popup window. The text specified in the alt field or title field (your choice) will appear under the image. You can then decide the relative position of the images in the posts under the option page in the admin panel. Image can float always left, always right or according to the align parameter (meaning different post by post if you wish so).

Version.
Current version of the plugin is 0.5, released on 5.10.2009. The plugin has been tested only on WP 2.7.1. If you have other experience on other versions of WP please leave a comment here.

License.
The plug-in is released under GPL license, meaning it’s free. If you like it or if you need help feel free to leave a comment here – and hopefully I will get some monetary feedback from the people who will find interesting ads to click on.

History.
V0.1
-First release

V0.2
-Add a preview pane in the admin panel
-Add a easy-update link in the admin panel
-Set the width of the box sourrounding the image as big as the image itself

V0.3
-Fixed the ‘use no border’ bug
-Use local/relative URI for images hosted on localserver (solves error:
getimagesize(): URL file-access is disabled in the server configuration )
-Image can float constantly left, constantly right or left/right according to the align parameter

V0.35
-Fixed several bugs
-Add the padding and margin settings to adjust border of the image

V0.4
-Works with an unlimited number of images -Image box will fit also when image is resized using the width parameter

V0.5
-Will work only if image tag contains the magic word “alt2legend”.
E.g.:<img src="image.jpg" alt="This is a caption" alt2legend />
Also, included in wordpress plugin repository.
Take a look also to my other plugin, fancy-pullquotes.

38 Comments

  1. Reply
    Skippy 23 October 2006

    Very interesting idea, a few problems.
    1. I can’t download it, I get a 403 error.
    2. It’s “caption”, not “legend”. Legend is quite a different thing.
    3. I’d rather it used the title attribute. The alt attribute’s specific purpose is to replace the image when it’s not displayed for some reason. If I’d have to make a caption I’d be using the title.

  2. Reply
    Giorgio 23 October 2006

    Thank you Skippy! I have fixed the link to the file.
    Plugin is named Alt-2-legend because I originally thought to use it for building figure legends; you’re right that caption is more appropriate in this case but I won’t change the name for now.
    As for the title attribute: as of now title and alt have the same description under wordpress so there is no difference in use unless you edit manually your posts. Anyway, I included your suggestion in my TODO list (i.e. choose btw ATL or TITLE from the option page).

  3. Reply
    Mike 28 October 2006

    Excellent plugin. This makes adding a caption to an image so much easier than messing with tables. Is there a way to specify where the caption is shown? Ideally I’d like to have it show under the image.

  4. Reply
    Giorgio 28 October 2006

    Thanks Mike. Caption should appear under the image by default unless you change the align image property from –Not Set– to something different in the insert image popup of WP. The plugin still doesn’t behave very well with either small images or long captions. I am working on it to fix that.

  5. Reply
    Giorgio 29 October 2006

    A new version (0.2) is out that addresses the issues mentioned above. Enjoy and let me know how it works.

  6. Reply
    gg 31 October 2006

    Michael, you get the URL file access error because in your server config, URL file-access is disabled, so entering a absolute url to an image under the same website won’t work. You should change the absolute path of the image to a relative one: for instance ww.hainsworth.com/images/image1.jpg should become simply /images/image1.jpg
    That should solve your problem.

  7. Reply
    Michael Hainsworth 31 October 2006

    Hi there, fantastic idea for a plug-in! Unfortunately it doesn’t work for me. Here’s what I get when I activate the plug-in and load up my site, HAINSWORTH.COM:
    Warning: getimagesize(): URL file-access is disabled in the server configuration in /usr/www/users/mhains/hainsworth/wp-content/plugins/figure_legend.php on line 47Warning: getimagesize(http://files.hainsworth.com/blog/lonely_heart.JPG): failed to open stream: no suitable wrapper could be found in /usr/www/users/mhains/hainsworth/wp-content/plugins/figure_legend.php on line 47
    Any ideas?

  8. Reply
    Giorgio 31 October 2006

    New version is out. fixes bugs, provides choice between title and alt and it’s more versatile on alignment setting. Enjoy.

  9. Reply
    Michael Hainsworth 31 October 2006

    Hi, GG,

    I tried that, and now I get:

    Warning: getimagesize(/blog/lonely_heart.JPG): failed to open stream: No such file or directory in /usr/www/users/mhains/hainsworth/wp-content/plugins/figure_legend.php on line 47

  10. Reply
    Michael Hainsworth 31 October 2006

    GG —

    did a little debugging. The leading slash must be removed to “blog/lonely_heart.JPG” versus “/blog/lonely_heart.JPG” for this to work.

    A couple of other points:

    I align my images within the post based upon the content. Sometimes they’re on the left, other times on the right. I would encourage you to remove the “float” option if possible to allow my “align=right” or “align=left” to determine where the image appears.

    I’ve also established in my CSS file the border padding around my images. Since I don’t want a dashed or other such border, I’d encourage you to disable the border padding your plugin creates in the event the border is set to “none” in the admin panel.

    BUT MOST IMPORTANTLY I HAVE TO DISABLE THE PLUGIN…

    Mostly, it’s this leading slash bug. I can’t go into all 1,300 posts to fix the ref= to accommodate the plugin. But I also need the left/right alignment of my images to remain as I’ve already set them.

    Are these issues you’re able to resolve? Or point me in the direction to how I can resolve them?

    Thanks, I really do love this plug-in.
    Michael

  11. Reply
    Michael Hainsworth 31 October 2006

    Oh, and I’m with Skippy:

    The ALT tag is for visually impaired browser users and browsers with images turned off. The TITLE tag would certainly be more appropriate.

    Michael

  12. Reply
    Mike 1 November 2006

    There is still an issue with the getimagesize function.

    File(../../../../../uploads/Image/Shiloh_web.jpg) is not within the allowed path(s): (/var/www/vhosts/mikekoepke.com/httpdocs:/tmp) in /var/www/vhosts/mikekoepke.com/httpdocs/wp-content/plugins/figure_legend.php on line 71

    Your own post displayed this error for my as well.

  13. Reply
    Mike 1 November 2006

    As a feature enhancement, it would be great to exclude specific pages or posts from having your plugin applied. Right now it is globally applied.

  14. Reply
    Giorgio 1 November 2006

    Your own post displayed this error for my as well.

    A post of mine is showing that error too? uh? really? which one? Everything looks fine from here. Mike, can you write me an email and be more detailed on the error you get on your server? Thanks.

  15. Reply
    Mike 2 November 2006

    Giorgio,

    It was actually this post that initially had a problem. Yesterday morning your server was running slow and I had trouble getting on. When I initially did, it gave the line 71 error for your image. When I came back in a 2nd time, everything was fine. When the error occurred you also rendered a SQL error. Must have been a a server fluke that is now fixed.

    I’ll do some more in depth troubleshooting on my end and email you. Besides the line 71 open_basedir issue, I also have some images not being rendered with the caption.

    Mike

  16. Reply

    […] Put caption on images in wordpress This is called ALT TO LEGEND wordpress plugin. Hope to utilize it in the future! […]

  17. Reply
    precious 6 November 2006

    does the caption show itself in every picture? or do we have the option to choose which pictures to use it? thanks! 😀

  18. Reply
    BloggingPro China » Blog Archive » WordPress Plugin: Alt to Legend 10 November 2006

    […]   Alt to Legend,显示图片属性中的ALT内容在图片的右下角。 alt image […]

  19. Reply
    Aleph Ozuas 30 November 2006

    Thank You Giorgio! I was looking for something like that for a long time. Your plugin is very handy! Grande abraço do Brasil!

  20. Reply
    suleiman 22 December 2006

    Hey so on my blog in IE the captions are appearing to the right of the images, but in other browsers it appears on the bottom where it should.

    Any ideas or fixes?

  21. Reply
    Leonardo 13 January 2007

    Just the first two images show the captions. From the third and beyond, no captions is shown. Is there a solution?

    Thanks.

  22. Reply
    Benjamin 23 January 2007

    I installed this extension and it worked great for a few seconds. I had a grey dotted border around my pics, and the captions looked good. I then started changing options in the panel (Options) and now all my pictures have a giant white area around them and nothing I change in options (color, line style, border size, checkbox for border) makes any difference. I can disable the extension and delete it (which appears to get rid of the effect) but when I reinstall it, the plugin “remembers” whatever I had last tried to set in Options, leading me to believe that it has modified other code somewhere. I really love the concept here and it looked like it was working great for a few seconds. Any help would really be appreciated.

  23. Reply
    Jason Rosenbaum 29 January 2007

    Nice plugin, but I’ve got one issue. Your plugin looks at the image source to grab the width and height for the max-width and max-height variables in the it creates. This doesn’t work for me. I often import images into my wordpress posts and then resize them a bit in the post window. When you grab the source file’s width and height, they end up being different then the width and height I’ve resized the image to, changing my layout. Can you fix this? I’ve tried to follow the code and do it myself but I haven’t been able to. Here’s what I’ve done so far:

    Changed line 53 to:

    // extract the src of the image and set the width of the box as big as the image width
    $image_src = get_between ($img_text, ‘width=”‘, ‘”‘);

    Commented out line 71:

    // list ($img_width) = $image_src;

    Then changed line 75:

    // Set the apperarance of the borders and the image according to user settings
    if ( $current_settings[‘use_border’] == false ) { $current_settings[‘border_style’] = ‘none’ ;}
    $div_open = ”;

    However, it doesn’t work. I get nothing outputted to max-width, just a blank space. Any ideas?

  24. Reply
    Francesco Minciotti 12 April 2007

    Hi Giorgio,

    even if I’m as italian as you (you should have noticed it from my name :)), let’s write in english in order to share informations with the rest of your audience.

    I’ve just installed your plugin under WP 2.1, and it rocks: it just places captions the way I hoped!

    Let me suggest one thing: when the user unchecks the “use border around the image” option, the plugin shouldn’t leave blank space around the image anyway. This screws up post’s layout, when the user only needs some texts under the picture.

    Thank you so much!

  25. Reply
    Ted 19 April 2007

    I’m getting the URL file access error on my blog, too. Can you post more detailed instructions on how to work around this? My host doesn’t appear to allow URL file-access at all.

  26. Reply
    Markus 20 April 2007

    Hei Giorgio!

    Great Plugin! Thanks for your work and time! Just one think: Sometimes i use picture also in the header or sidebar, but i won`t use the caption. Can you add an optionfield where the admin can add an class and/or an div inside the caption works. That will be really nice!

    Thanks a lot und have a nice weekend.
    Markus

  27. Reply
    Potaje de la Semana (XI) : potaje.net 21 April 2007

    […] ALT to Legend es un plugin para wordpress que añadirá el texto del atributo ALT de la imagen como leyenda al pie de la misma. […]

  28. Reply
    Gemme 24 April 2007

    Very nice plugin but unfortunately it doesn’t work for me (yet).

    I already have many pictures in old posts and using this plugin the alt text is placed at the right of the picture breaking the lay out. (most of my pictures are aligned to the left.

    If would be great if the alt text by default would be put on top of the picture and not breaking the lay out. Maybe in a next version?

    [giorgio says: the latest version (0.4) should always show the caption on the bottom side, at least with firefox. There is a bug with explorer, though. I’ll try to fix it asap.]

  29. Reply
    roloc 26 April 2007

    Great plugin, but the zipped file seems to be version .35, not .40

  30. Reply

    […] Alt to Legend is a plugin for WordPress 2.0 that allows you to display the ALT text of an image as its caption. […]

  31. Reply
    Keith 2 May 2007

    Definitely a great idea for a plugin but I’m afraid it doesn’t work for me.

    The legends don’t display and all I get is a dotted line around my images.

    [giorgio says: make sure you are putting the legend in the proper field (alt or title)]

  32. Reply
    Olof 3 December 2007

    Hi. Thanks for a great plugin. I just tried it on a WordPress Multi User install though and it installed fine and works with the default settings but changing the settings doesn’t work. It just says “Thank you for creating with WordPress MU | Documentation”.

    Kind regards.

  33. Reply
    Jermayn Parker 1 January 2008

    This looks very useful and just what I was after, I found this by the Weblog tools post…

  34. Reply
    Alt text used for image captions 14 January 2008

    […] Cafe Lamarck: Alt 2 Legend – This Plugin is ideal for non-web coders, as it allows you to control the appearance via an admin page which can be handy if you were after different borders using CSS. Only does measurements in em’s which could be a problem. […]

  35. Reply
    BaroqueW and his sidekick nikkitaa » Customisation de WordPress - Alt to Legend 24 February 2008

    […] Customisation de WordPress – Alt to Legend Posted in February 24th, 2008 by BaroqueW in Blog, Computer >> Practical Puisque je viens de migrer de Spip à WordPress, il y a pas mal de choses à refaire. Heureusement de nombreux plugins sont là pour me simplifier la tâche. Alt to Legend est un de ceux-là. Il permet en un tour de main de faire apparaître la légende des photos que vous ajoutez à vos articles. Il permet notamment de ne pas avoir à se salir les mains ou à plonger dans le code de vos thèmes pour tout faire vous-même. […]

  36. Reply
    BaroqueW 24 February 2008

    Very nice plugin, very easy to install/setup/use!

    Just a few things: the centering does not always work (especially with ‘text-align:center’ and ‘float : center’ – I replaced them by ” and ‘margin-left : auto; margin-right : auto;’).

    Also it would nice to plan something in the case a picture has no legend… or is it already there?
    Thanks for the plugin anyway!

  37. Reply

    […] Put caption on images in wordpress This is called ALT TO LEGEND wordpress plugin. Hope to utilize it in the future! […]

Leave a Reply to Michael Hainsworth Cancel reply

Your email address will not be published. Required fields are marked *