Articles of image size

Insert width & height attributes to all images displayed on each page

Using the WordPress the_content tag, I am running a custom function to search for all images that do not have a width and height attribute set and insert the proper dimensions. Below is the function: add_filter( ‘the_content’, ‘add_img_dimensions’ ); function add_img_dimensions( $image_no_dimensions ) { // Insert width & height to images missing dimensions if ( […]

Resizing Images for a Gallery-Plugin?

I’m currently working on a gallery plugin similar to the one found on Posterous. I’m needing all images in the gallery in a very small thumbnail-size. Probably only 50px wide. What’s the best practice to implement the image resizing? 1.) Adding the Image size via add_image_size()? This method has the obvious disadvantage, that all previously […]

Generate fixed image sizes for different pages, eliminate sizes during upload

I’ve built a few sites in WordPress and in general I’m quite pleased with all the possibilities it has developed lately. There’s one main thing that is utterly confusing for end users; the sizes they have to choose when using an image. They really do not understand the concept of pixels, and then they also […]

How to change _wp_attachment_metadata specific value in SQL?

i had to resize a lot of existing images in my upload folder (around 1k). After reuploading them, WordPress of course, doesn’t recognize the new dimensions. My approach was to just change the size in the _post_meta table. But this looks like this: a:6{s:5:”width”;s:3:”330″;s:6:”height”;s:4:”1067″;s:14:”hwstring_small”;s:22:”height=’96’ width=’29′”;s:4:”file”;s:22:”2012/03/2-IMG_1540.png”;s:5:”sizes”;a:3:{s:9:”thumbnail”;a:3:{s:4:”file”;s:21:”2-IMG_1540-56×183.png”; … All I need to change is the “width” value […]

How to get current image's slug in WP_image_editor?

I’ve been writing some class and functions to modify the path of thumbnails. I extended the original WP_Image_Editor class to achieve custom structure. What i want: to store the thumbnails in different folders based on their slugs, in the upload directory. such as : What i have already done: class WP_Image_Editor_Custom extends WP_Image_Editor_GD { […]

Can I stop wordpress generating media sizes

I am using atelier theme on a shop website and I have seen the disk space grow rapidly. In my analysis, I have noticed that Atelier is creating 17 different media sizes when it uploads an image: thumbnail – 150×150 medium – 300×300 medium_large – 768×9999 large – 1024×1024 shop_thumbnail – 180×180 shop_catalog – 800×800 […]

custom image dimensions (for gallery)

when uploading an image into the mediapool, wordpress will auto-resize it in several dimensions. unfortunately i’m requiring a special format which is kinda between thumbnail + medium. any ideas if it’s possible to do that? thanks

wp_get_attachment_image_src() width and height boolean

I have the following code in my theme: <?php $size = ‘large’; $postimage = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), $size ); $url = $postimage[0]; $h = $postimage[2] ?> <div style=”background-image: url(<?php echo $url; ?>); height: <?php echo $h; ?>;”></div> Here’s an example var_dump output for $postimage: array(3) { [0]=> string(99) “{base url here}/uploads/2013/10/h3greendeck.jpg?fit=660%2C660” [1]=> bool(false) [2]=> […]

Get total number of pixels, size in megapixels and aspect ratio based on image width and height?

Is it possible to show total number of pixels, size in MP, aspect ratio of current featured image? For example I use this to echo image dimensions of full sized featured image of current post. if ( has_post_thumbnail()) { $full_image_url = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), ‘full’); // echo image width echo $thumb_image_url[1]; // echo image height echo […]

Site icons with alpha channel for self-hosted WordPress blog network

Either I’m missing something (or have something badly configured in my self-hosted blog network) or when I’m uploading a transparent .png file (with alpha channel) using Media Library, my WordPress installation makes all possible cropped versions loosing transparency. This way, when I’m picking a perfectly transparent image for my site icon, I end up with […]