Articles of retina

Using SRCSET with Images and Featured Images

I have been trying to get SRCSET to load in images for different device sizes. My understanding is that when the device width or window width changes, that SRCSET will ONLY load the URL of the corresponding size. I can see the URLs generating for each image, as well as the sizes. These are all […]

Intersept image upload and generate retina image from source

My goal is to make a retina and non-retina image when user uploads a photo. This is doable like so: add_action(‘init’, function() { // Get the original image sizes and duplicate $thumb_w = get_option(‘thumbnail_size_w’) * 2; $thumb_h = get_option(‘thumbnail_size_h’) * 2; $thumb_crop = get_option(‘thumbnail_crop’); $medium_w = get_option(‘medium_size_w’) * 2; $medium_h = get_option(‘medium_size_h’) * 2; $large_w […]

Retina JS not working

I intend to develop a Retina ready theme. I uploaded retina.min.js on my theme folder: In my functions.php, I’ve added the following code: add_action( ‘wp_enqueue_scripts’, ‘retina_support_enqueue_scripts’ ); function retina_support_enqueue_scripts() { wp_enqueue_script( ‘retina_min_js’, get_template_directory_uri() . ‘/js/retina.min.js’, null, ”, true ); } add_filter( ‘wp_generate_attachment_metadata’, ‘retina_support_attachment_meta’, 10, 2 ); function retina_support_attachment_meta( $metadata, $attachment_id ) { foreach ( […]

Create image formats with different qualities when uploading

I’m trying to come up with a solution where the generated image formats cover both responsive and high-resolution aspects when uploading a new item in the WP admin. I’ve put together a set of formats that should meet these requirements, 2560 x 1600 retina desktop (‘largex2’, custom) 1280 x 800 desktop (large) 1920 x 1200 […]