[wp-trac] [WordPress Trac] #11394: Image shortcode

WordPress Trac wp-trac at lists.automattic.com
Fri Apr 9 17:54:03 UTC 2010


#11394: Image shortcode
-----------------------------+----------------------------------------------
 Reporter:  caesarsgrunt     |       Owner:                          
     Type:  feature request  |      Status:  new                     
 Priority:  normal           |   Milestone:  3.1                     
Component:  Media            |     Version:  2.9                     
 Severity:  normal           |    Keywords:  needs-patch dev-feedback
-----------------------------+----------------------------------------------

Comment(by caesarsgrunt):

 Replying to [comment:45 Otto42]:
 > What really bugs me is that you don't need to make a shortcode to
 accomplish any of the stated goals in the original ticket. It's overkill.
 >
 > Look at the goals:
 >
 > * allowing images to be trashed
 > * allowing plugins and themes to modify the code used to show images
 > * removing broken img tags from posts when the image is deleted
 >
 > All of these can be done with some clever use of classes and
 preg_matching. And it would be simpler and faster than using shortcodes to
 do it, in fact, because you wouldn't need to modify the existing code much
 at all.

 Not changing the existing code much != easier and faster. You can change
 the existing code to something as fast or faster, or your "small" change
 can be slower than a more in-depth rewrite of a portion of the code.

 I think your solution is probably slightly slower actually, because it
 means the post has to parsed another time, in addition to the existing
 shortcode parser.

 > Look, I'll give you an example. This code will find all img tags in a
 post and parse them, then spit out their src and class.
 >
 >...
 >
 > Pretty simple, really. If the class contained something like,
 attachment-123, then finding the 123 and checking to see if the image was
 deleted would be rather straightforward, wouldn't it?

 Yes, but you've just broken your data portability concept. Because now,
 when you use the post straight from the database, you'll end up with
 broken images in it, which you wouldn't have looking at it in WordPress.

 Besides, it's a rather ugly hack. If you're going to treat the HTML as a
 shortcode, better to just have a shortcode.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/11394#comment:50>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list