Category Images II

This plugin allows you to upload images for categories and custom taxonomies, and provides a template tag to show the image(s) in your theme.

To activate the images for a custom taxonomy, go to Settings > Category Images II.

To upload an image for a category, or a term in a custom taxonomy, go to the edit screen for that category or term.

Download

Latest version: Download Category Images II v1.33 [zip]

Installation

The plugin is simple to install:

  1. Download category-images-ii.zip
  2. Unzip
  3. Upload category-images-ii directory to your /wp-content/plugins directory
  4. Go to the plugin management page and enable the plugin
  5. Give yourself a pat on the back

Changelog

v1.33 2011/08/20

  • Attempt to de-confuse the template naming situation

v1.32 2011/08/15

  • BUGFIX: Reported issue with the glob not returning anything, causing the foreach to fail when upgrading the data
  • Fixed class “name” property

v1.31 2011/08/14

  • BUGFIX: Default size wasn’t properly working, resulting in broken images
  • Slightly better documentation
  • Fix Nonce notice

v1.21

  • Cope with other taxonomies than just categories

v1.12 2010/06/18

  • BUGFIX: Cope with changes to category edit screen in WP 3.0

v1.11 2010/05/19

  • LOCALISATION: Added POT file for translators! Woo hoo!

v1.21 2010/05/18

  • ENHANCEMENT: You can now show images for other taxonomies than categories
  • ENHANCEMENT: You can now opt not to show the description, by passing show_description=0 in the args
  • ENHANCEMENT: You can now opt not to show the description, by passing show_description=0 in the args
  • Various bug fixes

v1.10 2010/05/18

  • ENHANCEMENT: Category images now link to the categories

v1.00 2009/02/24

  • RELEASE: Version 1.00

v0.40b 2009/02/23

  • ENHANCEMENT: Added ciii_category_archive_image after (Richard Strauss)[http://littlegreenblog.com] pointed out the flaws of ciii_category_images when used in archive.php outside the loop.

v0.30b 2009/01/13

  • ENHANCEMENT: Now compatible with both 2.6.5 AND 2.7

v0.21b 2009/01/13

  • FIXED: Through a triumph of copying and pasting the readme.txt, I managed to rename this plugin to “Author Listings”

v0.20b 2009/01/12

  • Category images can now be deleted.

v0.10b 2009/01/12

  • Plugin first sees the light of day.

70 Responses to “Category Images II”


  • Hi,

    Great Plugin!
    is it possible to extend the plugin to work for Pages too?
    I mein for simple WordPress Content-Pages, not for Blog-Categories?

    • You probably want to use Post Thumbnails (which will be renamed to “Featured Images” in WP 3.0 when it’s released). Read more about Post Thumbnails on the Codex (I imagine that page may move when the functionality is renamed).

      • Thanks for reply!

        The thing is, that we extended yout plugin already, so we can upload as many images as we want (for seperate innerfade-animations at each category), but we need it for pages, not categories…

        I don’t see any administration-possibility at Post Thumbnails…

  • I like this plugin a lot, but I’m wondering if it’s possible to display the images as links back to the category archive page? I’m displaying the images on my sidebar, and so it would be very helpful to have them actually link somewhere. Thanks!

  • Hi, again, Simon. I just upgraded to WP 3.0, and now my category images are not showing up in my sidebar. Any idea why?

    I checked the categories in admin and the images are still defined there.

    Thanks!

    • I’m getting the following error on WP3.0: Warning: Invalid argument supplied for foreach() in /home8/public_html/wp-content/plugins/category-images-ii/category-images-ii.php on line 233

      • I am getting this error message on WordPress 3.0 as well.

        • I’m also getting the same error of the invalid argument on line 233 (but still using WP 2.9.2) – any thoughts on how to repair?
          Many thanks!

          • I upgraded to 3.1 and I am getting the same error in line 233, and when I downgraded I get this message: Sorry, something went wrong with the image upload. Please try again, or contact the website administrator.

            What should I do? any one came up with the solution?

      • Have this with all recent versions of WP, every time I move away from version 1.11. No solution yet?

      • Getting the same error

        Warning: Invalid argument supplied for foreach() in /home/content/73/7702473/html/wp-content/plugins/category-images-ii/category-images-ii.php on line 233

        when using ‘ciii_category_archive_image();’

        the other tags work great. Thanks for the great plugin!

  • I get an error every time I try to load up a picture…

    —-

    Warning: mkdir() [function.mkdir]: Permission denied in /home/pointful/public_html/wp-content/plugins/category-images-ii/category-images-ii.php on line 380

    Warning: move_uploaded_file(/category-images-ii/300.original.jpg) [function.move-uploaded-file]: failed to open stream: No such file or directory in /home/pointful/public_html/wp-content/plugins/category-images-ii/category-images-ii.php on line 291

    Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move ‘/tmp/phpYVfGOm’ to ‘/category-images-ii/300.original.jpg’ in /home/pointful/public_html/wp-content/plugins/category-images-ii/category-images-ii.php on line 291

  • I’m having a small issue with this – in that multiple category images are showing up when there is more than one post in the category. If I edit the code to just display certain categories, nothing shows up.

    Is there any way to fix this?

  • How do I get only the original size of the images?

  • This is happening for me too. When my client upgraded to WordPress 3.0, the images disappeared. They were being called directly from the theme code.

  • Hey there Simon, I wanted to say thanks so much for this great plugin. Quick question (same as Homem above) how do I control the side of the image that shows up? Thanks buddy!

    -Justin

  • I figured it out! If you change the category-images.php file to this:

    <a href="”><img src="” alt=”" />

    then it will display the original image!

    (Category-images.php is located in category-images-ii/view/category-images-ii/)

    Best of luck to everyone and thank you Simon for putting together very easy to understand code!

    -Justin

  • crap – let’s try that again:

    <a href=""><img src="" alt="" />

  • ok it won’t let me display the code- simply open up the file in notepad and change “thumbnail” to “original” and it should work fine!

  • Hi, Simon
    thank you for this useful piece of code!

    I like the idea of the plugin but I have a little problem.
    The installation is OK ( I’m using WP 3.0 ) and so is the upload of the image.

    The weird things is that there are pictures showing on categories without pictures.
    For example – I have a product in one category – with the brand name and the same product in different category.
    The different category does NOT have a picture but for some reason keep showing a picture from the other category the product is in.

    Azzaro Perfume is in cat.Azzaro and in cat. Woman Perfumes
    Woman Perfumes is showing the picture from cat.Azzaro ?!

    :)
    How should I fix this ?

  • Hi Simon,

    Thank you for the code.
    The onlything I noticed is that the uploaded file couldn’t be deleted by the script/ftp client.

    so I added a chmod action in the IF ELSE on line 291 of plugin.php.

    Now the files can be deleted.

    Have a nice day!

  • does this work with sub-category images as well? I can’t seem to make it show up.

  • Do you think it’s possible to get the category images from your plugin to be included when you call the function ‘wp_list_categories’.

    I’m guessing this would invovle changing the function in the core code, not something I’m keen to do. Have you any suggestions for a work around?

  • Hi
    is it possible to extend the plugin to work for custom taxonomy too?

    Thanks!

  • I’ve used this plugin, recently upgraded both to 3.0 wordpress and the plugin. All my images won’t display. They are in the folder category-images-ii still, but the template tag does not pull the url.

    Any ideas? I see some people have the same problem.

    • This is what I use to pull the categoryID
      <img src="cat_ID );?>”>

      and the output is

      Did something change with wordpress 3.0 or the plugin for this not to work anymore?

      • That didn’t post right. Forgot comments will kill the code.

        So I’m using this: ciii_category_images ( ‘category_ids=’. $cat->cat_ID );

        The spaces are there for this comment and of course the php strings as well I had to leave off.

        For whatever reason, the cat_ID is not pulling.

  • oops, I get an error message including “ in the archive template
    `Warning: Invalid argument supplied for foreach() in …/wp-content/plugins/category-images-ii/category-images-ii.php on line 233`

  • Same error after upgrade to 3.0.1,

    Warning: Invalid argument supplied for foreach() in /wp-content/plugins/category-images-ii/category-images-ii.php on line 233

    What could be causing this?

  • I’d also like to know if this will work with Custom Taxonomies. Doesn’t look like there is anything out there that can do that.

  • Hi,

    I found a bug when i use:
    ciii_category_images(‘category_ids=5,6′); :

    dont show anything the problem was on line 530.

    Replace:
    $CategoryImagesII->display_images( $cat_ids, $r[ 'link_images' ] );
    with:
    if ( ! $r[ 'echo' ] )
    return $CategoryImagesII->display_images( $cat_ids, $r[ 'link_images' ] );
    echo $CategoryImagesII->display_images( $cat_ids, $r[ 'link_images' ] );

    the problem is the use of $r[ 'echo' ].
    Pdd: sorry for my english

  • i am sorry, i forget the ‘return;’ at end

  • Has anyone got this solved in the WP 3.0.1 environment – I had previously posted with an Invalid argument supplied…line 233 error in 2.9.2, but got that working eventually.

    Can anyone confirm that this is working correctly in 3.0.1 (the stats on the WP plugin page say no…)
    Thanks in advance!

  • I got the category archive display to work in 3.0 if you use ciii_category_images() instead of ciii_category_archive_image()

  • i have the same problem with this: Warning: Invalid argument supplied for foreach() in /wp-content/plugins/category-images-ii/category-images-ii.php on line 233

    i tried to use this answer: I got the category archive display to work in 3.0 if you use ciii_category_images() instead of ciii_category_archive_image()

    but the problem still there, any help for this? – i use this for category archive :

  • I am having trouble with the plug-in I downloaded , uploaded , and activated it and added an image to a category but it won’t show can anyone help me please with this problem ?

  • Tried calling this outside the loop using both ciii_category_images() and ciii_category_archive_image(); in my template and also received the following error.

    Warning: Invalid argument supplied for foreach() in /home/myname/public_html/wp-content/plugins/category-images-ii/category-images-ii.php on line 233

  • Tried calling this outside the loop using both ciii_category_images() and ciii_category_archive_image(); in my template and also received the following error for the ciii_category_archive_image();.

    Warning: Invalid argument supplied for foreach() in /home/myname/public_html/wp-content/plugins/category-images-ii/category-images-ii.php on line 233

    ciii_category_images() just doesn’t display anything… .

  • Hi , nice plugin , but i have a question.

    When i try ciii_category_images(“category_ids=37″);

    but it does not give me the category image.

  • Can anyone help with this?

    I’d like to show a list of ALL categories, each with their relevant category image.

    I’m basically trying to make a sidebar list widget that will list them and show correlating category pics.

    It looks like the category-images.php should do it, but I can’t quite figure out how to make this show?

    Thanks in advance

    <a href="”><img src="” alt=”" />

  • Hi, I’m having a problem. I can’t upload an image when a I create a category, but after create it I can edit the category and upload an image. Any idea of why I can upload an image when I create a category???

    Thanks!

  • Anyone get this to work? I upgraded to 3.2 and started getting fatal errors everywhere.

    I was using

    echo $CategoryImagesII->display_images( array(6),”1″ );

    previously and it worked great, but none of the template tags work either…

  • Wrapped in PHP tags of course…

  • I just upgraded to the latest version and it kills the images that were previously there. Technically they are not gone they are in the cached uploads folder. However they do not show.

    I reverted back to the previous version of the plugin, but they still do not show. Is there a way to reset it so that the images come back?

  • There’s an error in the script files. There is a “return” missing.

  • Upgraded to the latest WordPress version and this plugin has stopped displaying images, any ideas how to fix this?

  • Just Upgraded to v1.31 (with WP 3.2.1)
    Getting Errors on pages ( using: ciii_category_images() )
    “This plugin template could not be found “templates/temp-images.php”

    And in Admin (settings > Category Images II):
    “This plugin admin template could not be found: /templates-admin/options-page.php”

    Any ideas / fixes?

  • Hi, just wondering if you were planning on supporting any of the other arguments to WordPress’ get_terms function? I ask because the one that I’ve found useful would be ‘hide_empty’.

    At the moment ciii_terms_images will only show categories/terms with images, and exclude them if not. But i’ve found it useful to have an option to show ‘empty’ categories along with categories with images.

    I did this by adding a new line within template-tags.php after line 55 of 'hide_empty' => true, and changing line 201 of class-Category-Images-II.php to read as if ( $args['hide_empty'] && ! $term[ 'thumb' ] = $this->get_image_url( $term_id, 'thumb' ) )

    Not sure if you’d want to add it into your next version or not.

  • Hi mate, This is really a quick work around for having category images displayed for individual categories. Wondering if there is a option for this to work for custom post types aswell. Please do suggest on how to get this working for post types..

    Cheer.

  • hey man,
    little issue im having this morn, been using the plugin for a few weeks now on a development project, images etc all showing, now this morn, i tried to login to /wp-admin/ and im shown this error..

    Fatal error: Uncaught exception ‘Exception’ with message ‘Problem migrating data, no ID. Sorry

    never seen this before, it gives the error on:
    plugins/category-images-ii/class-Category-Images-II.php on line 607

    if ( ! isset( $matches[ 1 ] ) )
    throw new exception( “Problem migrating data, no ID. Sorry.” );
    if ( ! isset( $matches[ 2 ] ) )
    throw new exception( “Problem migrating data, no file type. Sorry.” );
    commenting out the throw new exception,
    will let the page load?

    on wordpress: 3.2.1
    cheers

    • Hi Marty,
      I got the same error. I got this error because I renamed or delete some category image from uploads directory. You can also check this kind of thing.

Leave a Reply