• Is it possible to simply query the WordPress DB for the types of images created when an image is uploaded?

    For example, I upload an image and it creates 7 images…
    aMEsvTUklw0uZ3gk3Q6lAj6302a.jpg
    aMEsvTUklw0uZ3gk3Q6lAj6302a-50×50.jpg
    aMEsvTUklw0uZ3gk3Q6lAj6302a-150×150.jpg
    aMEsvTUklw0uZ3gk3Q6lAj6302a-200×300.jpg
    aMEsvTUklw0uZ3gk3Q6lAj6302a-400×280.jpg
    aMEsvTUklw0uZ3gk3Q6lAj6302a-680×330.jpg
    aMEsvTUklw0uZ3gk3Q6lAj6302a-683×1024.jpg

    I know that a bunch are generated due to the current theme I use. So the breakdown… The first image is of course the original. I think 150×150, 200×300, and 683×1024 are standard default settings for WordPress itself (that I can change in the settings). The rest (50×50, 400×280, 680×330) I think are generated per my theme.

    I want to be able to simply query the raw WordPress database and get back the 6 EXTRA images to create.

    Is this possible?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Moderator bcworkz

    (@bcworkz)

    Not for the images other than the default sizes. The default sizes are stored in the options table. Additional sizes are stored in the global array $_wp_additional_image_sizes;

    Depending on the crop settings, the array may not give you the entire picture. There’s a number of functions in wp-includes/media.php that help you get the actual image data for defined sizes, for example wp_get_attachment_image_src().

    Thread Starter arvobowen

    (@arvobowen)

    Yea I know, but that does not help me for what I’m doing… I don’t have access to the WordPress interface. All of this is being done on the backend.

    Is there any way possible to get those additional sizes without using the wordpress site itself?

    Is there some type of WordPress API I could access to return the info I seek?

    Moderator bcworkz

    (@bcworkz)

    Well, there’s XML-RPC_WordPress_API but it’s rather limited. ‘wp.getMediaLibrary’ looks interesting but I don’t know what you actually get. There may be some sort of extension that would help, like WP-CLI, but if you don’t have access you probably couldn’t install it. Catch-22.

    You could actually code your own dedicated interface as plugin, but again, you probably can’t install it.

    Thread Starter arvobowen

    (@arvobowen)

    Thanks!

    I didn’t mean I don’t have the access rights to get to it (I own the site and i’m site admin). I was just trying to give the impression I was not doing any of this ON THE SITE itself. This is all external of WordPress. That’s why I do not have access to those WordPress functions/methods. I’ll check out the XML-RPC_WordPress_API that might be what I need. If that is what I think it is… I wish I knew about this before I made this app… :/

    Thanks again!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Get all the types of image sizes from WordPress DB’ is closed to new replies.