[wp-trac] Re: [WordPress Trac] #6812: Image captions

WordPress Trac wp-trac at lists.automattic.com
Thu Jun 19 23:02:07 GMT 2008

#6812: Image captions
 Reporter:  matt            |        Owner:  azaozz
     Type:  enhancement     |       Status:  new   
 Priority:  normal          |    Milestone:  2.6   
Component:  Administration  |      Version:  2.5   
 Severity:  normal          |   Resolution:        
 Keywords:                  |  
Comment (by azaozz):

 Have been thinking what's the best way to do this. Generally there seem to
 be four options:

 - Hard-coding the caption tags when the image is inserted. That seems like
 easiest/most compatible way. Will only need few lines of css added to
 wp_head(). Disadvantages: cannot be removed later without editing the
 posts, no backwards compatibility.

 - Filtering the content and adding them to each image. This will require a
 regexp filtering for the blog and similar js for TinyMCE. Advantages:
 backwards compatible, can be disabled. Disadvantages: the regexp have to
 run on each page load and may have to check image sizes (captions on
 thumbnail sized images don't look good). That could be problematic/quite
 slow when the image is hosted elsewhere and width/height are not set.

 - A combination of the above two. A shortcode can be added around the
 image tag when inserting the image, then either rendered or removed when
 displaying the post (or perhaps the whole image tag can be a shortcode).
 Still won't be backwards compatible, but display of captions could be
 enabled/disabled on demand.

 - The captions can be handled entirely with JavaScript. This seems the
 most flexible way. It would be backwards compatible and could be
 enabled/disabled at any time. Disadvantages: may conflict with some
 plugins that also use js to change the images (that is also a possibility
 for all methods).

 Also think that we will need another checkbox in the miscellaneous
 settings to enable/disable the captions globally.

Ticket URL: <http://trac.wordpress.org/ticket/6812#comment:1>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software

More information about the wp-trac mailing list