All posts tagged “image”

15 Superb Free jQuery Image Sliding Plugins

JQuery plays a vital part in the web design industry. The widely used are the free responsive jQuery image slider plugins for crafting attractive image sliders or photo gallery with amazing effects…

For full article and other interesting tech related stuff visit the website.

Optimize Your Images With Pre-Defined Image Sizes [WordPress Tip]

Optimizing images on a website is a daunting task. You can choose to use fewer images, compressed images, sprites or svg; the list goes on. One place where many WordPress sites get tripped up is in defining image sizes, which is a crucial aspect of optimizing content-heavy sites.

Image sizes are vital because images are automatically created according to the sizes given when images are uploaded. This ensures that even if you have a 3000px wide original image, it is never used if a 600px image is enough. Ideally a 600px wide space should use a 600px wide image instead of scaling down a larger one.

In this article I’ll walk you through what image sizes are and how to define them.

How WordPress Handles Images

If you’ve ever inserted an image in a WordPress article you should have come by the image size selector. This lets you insert small, medium and large versions of the images. The actual sizes for these can be modified in the WordPress settings.

Whenever you upload an image through WordPress, it generates versions of these images and stores them separately. For example, if you upload a 1200×800 image, WordPress may create 100×100, 600×400 and 900×600 versions. When you insert an image and choose "medium" the actual medium version will be used, as opposed to a shrunk down version of the original.

This is hugely beneficial because it conserves bandwidth on the server and processing time on the client computer. I think it comes as no surprise that downloading a 600×400 image is faster than downloading a 1200×800 image.

If a larger image is used which needs to be scaled down, the browser needs to take care of the calculations to make this happen. While this won’t take hours, it may be noticeable on image-heavy websites.

The Right Image In The Right Place

The ultimate goal should be to always use appropriate image sizes. If you need a 440×380 image, then grab an image with that exact size from the server. There are two main places where you’ll be using uploaded images: featured images and in-post images – I would advise focusing on featured images first.

In all but the most visually directed articles it doesn’t really matter if an in-post image is 220px or 245px wide. Whichever version you have available would be equally usable. Featured images however are usually shown at common sizes. For article lists you may use a 178×178 thumbnail, for article headers you may use a 1200×600 wide image.

In addition to these you may also want to keep a separate thumbnail / medium / large size as defined in the settings to give you easy access to specific dimensions when adding images to posts.

So what it all boils down to is this: Wouldn’t it be great if we had two extra image sizes which we could use for featured images? These image sizes would be created right alongside the rest when an image is uploaded. The good news is that WordPress has you covered with a pretty simple function.

Creating Image Sizes

By using the add_image_size() function you can define all the image sizes your website needs. Let’s create the two examples mentioned above. Place the code below in your theme’s functions.php file or in a plugin’s file.

 add_image_size( 'featured_thumbnail', 178, 178, true ); add_image_size( 'featured_wide', 1200, 600 ); 

As you can see, this function takes four parameters. The first parameter allows you to set a name for the size. The second parameter is the maximum width, the third, the maximum height. The fourth parameter sets hard cropping. If set to true, the image will be created at the exact size you specify.

Once this has been added to your theme or plugin two new versions of each file you upload will be created by WordPress.

Using Image Sizes

These image sizes can be used in a number of functions which deal with retrieving media. Let’s look at featured images first. the_post_thumbnail() is commonly used to display a post’s featured image. The following code can be placed in a WordPress loop:

 the_post_thumbnail( 'featured_thumbnail' ); 

The first parameter of this function allows you to specify the image size to use. Since I’ve specified "featured_thumbnail", the 178×178 version of this file will be used.

There are a number of other functions such as wp_get_attachment_image()and wp_get_attachment_image_src() which also use the image size parameter. Whenever you use such a function you should always specify an appropriate image size.

Regenerating Thumbnails

If you already have a site in place, you won’t be able to optimize your articles retrospectively just by defining an image size. Image sizes are only taken into account when a new image is uploaded, so they are not applied to images already in the system.

Fear not, the Regenerate Thumbnails plugin will make things all better! This plugin can regenerate the thumbnails for all your images, taking into account all defined image sizes. It can also target a specific image, which is useful if you just have a few, or you’re doing some testing.

Once your thumbnails are regenerated you should see the optimized versions loaded on your site. You can check this out by viewing the source of the image. If you uploaded ‘example.jpeg’ and you see ‘example.jpeg’ as the source for your featured image, something isn’t right. If you see “example-178×178.jpeg” then all is well; the optimized image is shown.

Responsive Images

One difficulty in maintaining an optimized site is responsiveness. When I view an article on the iPad an in-post image of a large size will be downscaled since the maximum width will be 786px or so.

The easiest solution is to use a plugin like Hammy. Hammy works based on the content width of your theme (as opposed to the window width of the browser) and can serve optimized images based on that. This is especially handy for mobile users where processing power and bandwidth may be an issue.

Further Image Optimization

As I mentioned in the introduction there are countless ways to optimize images. From sprites to image compression a lot of techniques can be used to decrease the load times which come hand in hand with images. Ashutosh KS has written a great article showcasing 9 WordPress Plugins To Improve Image Performance, I suggest giving it a read!

I also suggest taking a look at Hassle Free Responsive Images which shows you how to add support for the picture element, something you’ll want to use if you want to write your own code.

How to Retrieve Your Gravatar Image URL

Having a profile picture also known as “avatar image” is pretty essential online. We upload our best profile picture on websites and social sites for legitimacy, credibility and for people to better recognize our online presence.

WordPress has its own service to deliver user profile pictures, and it is called Gravatar. We can also incorporate this into our own customized themes. This post will walk you through a couple of approaches on how you can retrieve the profile image from Gravatar.

Using Gravatar

Let’s start from the basics. WordPress has a special integrated function, get_avatar, which allows us to retrieve the gravatar image. This function requires two parameters: the user ID or email, and the size of the image to display. Here is an example.

 $  user_id = get_the_author_meta('ID'); echo get_avatar($  user_id, 80); 

If you prefer using a user email, fill the get_the_author_meta() function with user_email:

 $  user_id = get_the_author_meta('user_email'); echo get_avatar($  user_id, 80); 

Both examples will output the same result: a user avatar image with the size of 80px. In my case, I will see my picture.

The example output of Gravatar

Yet, the problem that I once encounter with this function is that the function generates the whole image; a full <img> tag. Inspect the code source, and you should find it as follows:

This makes things a little bit tricky for us, for example, to insert additional classes or an ID into the <img>.

Alternatively, we can retrieve only the image URL, instead of the <img> element in full. Once we got the URL, we can add it to the <img> with the custom classes or ID added.

How To Retrieve The Image URL

First, we will need to create a new PHP function in functions.php of the WordPress theme you are using. Let’s name the function as follows:

 function get_avatar_img_url { } 

Retrieving the Gravatar image requires the user email; make sure that the email has been registered in Gravatar in order to see the output. Call the author user email, like so.

 function get_avatar_img_url { $  user_email = get_the_author_meta( 'user_email' ); } 

The Gravatar image URL is specified with and followed by md5 hash (encoded value) of the email address. To return the email addrress into an “md5 hash” value, we can use the PHP built-in function, md5(). Hence we set out the Gravatar image URL this way:

 function get_avatar_img_url { $  user_email = get_the_author_meta( 'user_email' ); $  url = '' . md5( $  user_email ); } 

Next we need to include a couple of required parameters into the URL which are the image size and the default fallback image if the image is not registered in Gravatar. To do so, we will use a WordPress function called add_query_arg.

 function get_avatar_img_url() { $  user_email = get_the_author_meta( 'user_email' ); $  url = '' . md5( $  user_email ); $  url = add_query_arg( array( 's' => 80, 'd' => 'mm', ), $  url ); return esc_url_raw( $  url ); } 

This add_query_arg function will add parameters at the end of the URL. In our case, it will output ?s=80&d=mm which sets the image size to 80pixels and sets the default avatar to mm (Mystery Man).

Now just use the PHP echo to output the URL within the <img> element, like so:

 $  avatar_url = get_avatar_img_url(); echo '<img src=" ' . $  avatar_url . ' ">';

12 Mind Blowing Photoshop Actions That Transforms Any Image into a Piece of Art

previewLets kick this off by saying that these Photoshop actions literally made my jaw drop. Rewind 10 years, there I am spending hours upon hours in Photoshop creating pieces for fun that are similar to the outcomes of these Actions (I will be the first to admit that these outcomes are slightly better), fast foward […]
Inspiration Hut – Everything Art and Design

Match your camera angle to a background image in 3ds Max

Read more about Match your camera angle to a background image in 3ds Max at

3ds Max’s Perspective Match tool perfectly aligns models and backgrounds

Creative Bloq

Weevmee Captures a Year in One Image: A new technology from design agency HUSH artistically weaves personal Instagram images

Weevmee Captures a Year in One Image

Leading up to new year’s eve, social media sites fill up with flipbook-like posts compiling the best of users’ years. As a more artistic option, drawing upon the colors and tones of the last 365 days, NYC-based design agency HUSH developed Weevmee;……

Continue Reading…

Cool Hunting

Art Basel with PHHHOTO: The motion-capturing photo app introduces five artistic image filters for 24 hours each

Art Basel with PHHHOTO

We’ve long been fans of motion-capturing social photo booth PHHHOTO from our friends at HYPERHYPER, perhaps since even before its official inception in early 2013. Though their looped-motion image-creating booth is always an event favorite, the introduction……

Continue Reading…

Cool Hunting

Twibfy Image Marketplace: An aesthetically driven platform for finding, organizing, buying and selling quality visual content online

Twibfy Image Marketplace

As it stands, when searching for stock photos, publications and the general public have few options for quality, legal images worth publishing. And, as a photographer or artist, there are even fewer ways to combat having your work plagiarized or……

Continue Reading…

Cool Hunting

Sony’s A7 II mirrorless camera adds faster autofocus and better image stabilization

Sony has upgraded its pioneering A7 full-frame mirrorless camera with a few improvements that should make it more responsive and enjoyable to shoot. The A7 II’s headline feature is 5-axis image stabilization, an ability first seen on the Olympus OM-D E-M5 back in early 2012 but never before on a full-frame camera. This is, in fact, the first mirrorless camera from Sony to feature in-body image stabilization at all, meaning you’ll be able to take longer (and therefore brighter) exposures in low light no matter what lens is attached.

Next, Sony has improved the A7 II’s autofocus system, claiming that it will lock focus around 30 percent faster than its predecessor; a welcome addition if true, given the A7’s poor performance in that…

Continue reading…

The Verge – All Posts

About Town, a Four-Day Video Art Event: Celebrating Ikon gallery’s 50th anniversary with a festival focusing on the magic of the moving image

About Town, a Four-Day Video Art Event

It’s been 50 years since art gallery Ikon in Birmingham, UK, was established by an artists’ group that wanted the space to be “an antithesis to exclusive art establishments and galleries.” This weekend it’s celebrating that…

Continue Reading…

Cool Hunting