Make WordPress Core

Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#20980 closed defect (bug) (fixed)

Remove unused images

Reported by: helenyhou's profile helenyhou Owned by: azaozz's profile azaozz
Milestone: 3.5 Priority: normal
Severity: normal Version: 3.4
Component: Graphic Design Keywords:
Focuses: Cc:

Description

wp-admin/images holds quite a few images that have stopped being used along the way but appear to not have been removed. We should also check wp-includes/images and remove these images.

This is the list I have from May 7 (all in wp-admin/images). I had question marks next to a few that I wanted to look into more carefully.

  • ed-bg.gif
  • fav-arrow.gif
  • fav-arrow-rtl.gif
  • fav-vs.png
  • fav.png
  • loading-publish.gif
  • logo-ghost.png
  • logo.gif (?)
  • media-button-*.gif (?)
  • menu-arrow-frame-rtl.png
  • menu-arrow-frame.png
  • menu-arrows.gif
  • menu-dark-*.gif
  • required.gif
  • screen-options-toggle*.gif
  • se.png
  • toggle-arrow*.gif
  • upload-*.png (?)
  • widgets-arrow*.gif

We would also be able to get rid of ed-bg-vs.gif if we update the gradient in the blue (classic) stylesheet to use CSS instead.

Attachments (4)

20980.patch (6.9 KB) - added by azaozz 12 years ago.
20980-2.patch (1.7 KB) - added by azaozz 12 years ago.
20980-3.patch (1.8 KB) - added by ocean90 12 years ago.
20980-4.patch (2.5 KB) - added by azaozz 12 years ago.

Download all attachments as: .zip

Change History (28)

@azaozz
12 years ago

#1 @azaozz
12 years ago

The patch contains all old images however some are still used by plugins, example search.

#2 @nacin
12 years ago

  • Milestone changed from Awaiting Review to 3.5

#3 follow-up: @georgestephanis
12 years ago

media-button-image.gif and media-button-video.gif are both still used by Press This

#4 in reply to: ↑ 3 @helenyhou
12 years ago

Replying to georgestephanis:

media-button-image.gif and media-button-video.gif are both still used by Press This

#19569 - it should be made to match.

#5 @markjaquith
12 years ago

Summary of IRC convo with helenyhou:

markjaquith: On one hand, plugins using core images is a good thing — means they're at least attempting to stay with Core's UI. But on the otherhand, these are images we're not using anymore.

helenyhou: basically, i agree that images that aren't used in core itself anymore aren't really core UI anymore. and i want to kill them all off. but don't know how that's going to make plugin/theme devs feel.

markjaquith: If we do that, we're signalling that plugin and theme devs should supply their own images. Which could just be copies of ours.

markjaquith: I'm actually okay with saying that plugin and theme devs should use their own copies. I mean, the images could change anyway. We could update colors, update gradients. So they're already at our mercy.

helenyhou: markjaquith: i'm okay with that, too.

#6 follow-up: @helenyhou
12 years ago

A side, semi-related thought - if we have core images that we think folks may want to use (gradients would have been an example, but we should be CSS-ing them at this point), perhaps we should have generic classes in wp-admin.css for easy access.

#7 in reply to: ↑ 6 ; follow-up: @azaozz
12 years ago

Replying to helenyhou:

... perhaps we should have generic classes in wp-admin.css for easy access.

Most WP images used by plugins are in <img> tags, not sure we need to provide generic css classes for when they are used as backgrounds. Thinking it's reasonable to expect plugins to switch to css gradients too.

This brings another (big) question though: how much of the core css is "safe" for use by plugins (if any), and how are we going to separate it from the rest of wp-admin.css.

#8 in reply to: ↑ 7 ; follow-up: @helenyhou
12 years ago

Replying to azaozz:

This brings another (big) question though: how much of the core css is "safe" for use by plugins (if any), and how are we going to separate it from the rest of wp-admin.css.

Too bad we can't prefix classes/IDs not meant for direct use with an underscore. Or deprecate CSS by doing .deprecated-class { border: 3px solid #f00; }. :)

#9 in reply to: ↑ 8 @azaozz
12 years ago

Replying to helenyhou:

Too bad we can't prefix classes/IDs not meant for direct use with an underscore.

Technically we can, both css classes and IDs can start and contain any UTF-8 char in HTML5/CSS3. Not sure how practical that's going to be though.

The idea to have a prefix for classes that can be used by plugins isn't bad. Seems as the simplest solution.

#10 @helenyhou
12 years ago

Did a more thorough search for the wp-admin/images directory and a quick one for wp-includes/images. tl;dr: Pretty much everything from my first list can go right now except for the media-button-* ones.

Good to go:

  • fav-arrow.gif
  • fav-arrow-rtl.gif
  • fav-vs.png
  • fav.png
  • logo-ghost.png
  • logo.gif
  • menu-arrow-frame-rtl.png
  • menu-arrow-frame.png
  • menu-arrows.gif
  • menu-dark-rtl-vs.gif
  • menu-dark-rtl.gif
  • menu-dark-vs.gif
  • menu-dark.gif
  • screen-options-toggle-vs.gif
  • screen-options-toggle.gif
  • se.png
  • toggle-arrow-rtl.gif
  • toggle-arrow.gif
  • upload-classic.png
  • upload-fresh.png
  • widgets-arrow-vs.gif
  • widgets-arrow.gif

Used in some plugins, but should still go:

  • ed-bg.gif (should use a CSS gradient instead)
  • loading-publish.gif (should probably use loading.gif instead, and it's that ugly one with the darkened frame)
  • required.gif

Still used in core (for now)

  • ed-bg-vs.gif (background gradient, see #16461 and #18141)
  • media-button-image.gif (Press This, see #19569)
  • media-button-video.gif (also Press This)

Used in some plugins, perhaps should keep?

  • media-button-music.gif
  • media-button-other.gif

wp-includes/images

  • upload.png

#11 @helenyhou
12 years ago

Found more! All in wp-admin.

  • archive-link.png
  • blue-grad.png
  • fade-butt.png (some plugin use)
  • gray-grad.png

#12 @coffee2code
12 years ago

If media-button-* are taken into account, there are 100 plugins by 79 authors making use of the admin images listed in the original ticket as being considered for removal from core. (One author has 13 plugins in that group, all referencing the same image.)

Without taking into consideration media-button-* images, there are only 38 plugins by 33 authors.

Here's a breakdown of image use (counting each plugin only once for each different image it uses):

IMAGE COUNT
ed-bg.gif 8
fav.png 10
fav-arrow.gif 9
fav-vs.gif 1
loading-publish.gif 4
logo-ghost.gif 5
media-button-image.gif 57
media-button-music.gif 7
media-button-other.gif 9
media-button-video.gif 12
menu-arrows.gif 2
toggle-arrow.gif 6
required.gif 1
screen-options-toggle.gif 1
screen-options-toggle-vs.gif 1
upload-*.gif 1

The scans took into account various usages:

  • admin_url( 'images/XXX' )
  • admin_url() . '/images/XXX'
  • relative referencing to wp-admin/images/, and to images/

Plugins that packaged and referenced their own version of the given named images were excluded.

I've run a separate scan for the 4 images @helenyhou added in the preceding comment (11) but will report them separately, shortly. However, I can say that gray-grad.png and fade-butt.png have widespread usage by plugins.

#13 follow-up: @coffee2code
12 years ago

Plugin usage for the four files brought up in 11:

IMAGE COUNT
archive-link.png 0
blue-grad.png 10
fade-butt.png 40
gray-grad.png 70

#14 in reply to: ↑ 13 @helenyhou
12 years ago

Replying to coffee2code:

Thanks so much for running the actual numbers. Excluding the media-button-* images, which I think pretty clearly need to be left alone for now, I'd still say that we can send the message to plugin authors that they need to copy images over for use, especially since the ones most frequently used are just gradients and at this point should probably be done in CSS anyway.

Some (most?) of the others have possible substitutes as is. We could go through and identify these in more detail.

#15 @azaozz
12 years ago

Yes, thanks @coffee2code for the detailed info.

Agree with @markjaquith and @helenyhou that plugins should use their own copies of the images and follow core in replacing image gradients with css3 gradients. (Considering that removing a background image that is a gradient would not break any functionality).

Think a revised patch can be committed as soon as the last few image gradients are replaced with css3 gradients, see #16461.

Last edited 12 years ago by azaozz (previous) (diff)

#16 @ocean90
12 years ago

  • Cc ocean90 added

#17 @ocean90
12 years ago

I wrote a smart bash script which searches through the WordPress core and outputs unused images: https://gist.github.com/3276105

Currently it returns 34 unused images:

wp-admin/images/archive-link.png
wp-admin/images/blue-grad.png
wp-admin/images/ed-bg.gif
wp-admin/images/fav-arrow-rtl.gif
wp-admin/images/fav-arrow.gif
wp-admin/images/fav-vs.png
wp-admin/images/fav.png
wp-admin/images/gray-grad.png
wp-admin/images/loading-publish.gif
wp-admin/images/logo-ghost.png
wp-admin/images/media-button-music.gif
wp-admin/images/media-button-other.gif
wp-admin/images/menu-arrow-frame-rtl.png
wp-admin/images/menu-arrow-frame.png
wp-admin/images/menu-arrows.gif
wp-admin/images/menu-dark-rtl-vs.gif
wp-admin/images/menu-dark-rtl.gif
wp-admin/images/menu-dark-vs.gif
wp-admin/images/menu-dark.gif
wp-admin/images/required.gif
wp-admin/images/screen-options-toggle-vs.gif
wp-admin/images/screen-options-toggle.gif
wp-admin/images/toggle-arrow-rtl.gif
wp-admin/images/toggle-arrow.gif
wp-admin/images/upload-classic.png
wp-admin/images/upload-fresh.png
wp-admin/images/widgets-arrow-vs.gif
wp-admin/images/widgets-arrow.gif
wp-includes/images/archive.png
wp-includes/images/code.png
wp-includes/images/document.png
wp-includes/images/interactive.png
wp-includes/images/spreadsheet.png
wp-includes/images/upload.png

If #16461 goes in we have 4 more:

wp-admin/images/button-grad-active.png
wp-admin/images/button-grad.png
wp-admin/images/white-grad-active.png
wp-admin/images/white-grad.png

@azaozz
12 years ago

#18 follow-up: @azaozz
12 years ago

20980-2.patch shows the deleted files.

@ocean90 not sure where these come from but don't see the images in wp-includes/images:

wp-includes/images/archive.png
wp-includes/images/code.png
wp-includes/images/document.png
wp-includes/images/interactive.png
wp-includes/images/spreadsheet.png

@ocean90
12 years ago

#19 in reply to: ↑ 18 @ocean90
12 years ago

Replying to azaozz:

@ocean90 not sure where these come from but don't see the images in wp-includes/images:

That was a bug in the script, fixed now.


20980-3.patch includes images from [21461].

@azaozz
12 years ago

#20 @azaozz
12 years ago

Removed 2 more menu-bits*.gif, left over in the IE6 compat part of ie.css

#21 @ocean90
12 years ago

+1 for 20980-4.patch and removing the images. We should do it now and add a note on wpdevel make/core. Then there should be enough time to react on this change.

Also if coffee2code's scan was for all plugins in the repo then 100 isn't much – less than 1% of all plugins.

#22 @azaozz
12 years ago

  • Owner set to azaozz
  • Resolution set to fixed
  • Status changed from new to closed

In [21498]:

Remove unused images, props helenyhou, coffee2code, ocean90, fixes #20980

#23 @nacin
12 years ago

In [21594]:

Remove references to still-existing files from the old files array. see #20980.

#24 @nacin
12 years ago

To explain [21594], "Don't delete, yet" is designed to keep track of files we've removed from the SVN repo, but did not want to remove from new installs. So, the various root-level files like wp-feed.php, wp-register.php, etc.

Note: See TracTickets for help on using tickets.