Generate square image from portrait thumbnail - wordpress

I have portrait images with about 200x600 size. I would like to create a square version of it with 600x600 size.
Is it possible somehow?
Unfortunately the hard crop set the width first and I get only the center of the image.
add_image_size( 'square', 600, 600, true );
Required below. Upload portrait and get square version of it.

I recently found this plugin, https://wordpress.org/plugins/square-thumbnails which seems to do exactly what you need.
It will create a square thumbnail image and fit the original image inside the square.
I haven't tested it on a production site, so I can vouch for the plugin, but it's worth trying.

WordPress functions for image manipulation can't work like this, they can crop images, but they can't fill them up to be expanded.
Images can have different backgrounds, and automatically choosing colours for that is not easy to do. If the images are with background transparency, then, it is easier to do, but still, WordPress can't do that. I am not sure of any plugin for WordPress that can do this.
Best way to do this is to hire someone to code it for you, and again, it will work fine only if images don't have background.

Related

Image resizing issues

So im building my first wordpress site at the moment. Most problems i come across i just do a google search, read, learn, fix.
But one continuous problem i keep getting is images and resizing them.
Im really lost as to how it works, its so simple, yet i cant seem to manage them at all.
Heres some of my issues:
I'm using customizr theme, it has a slider, featured images for posts-big and small (featured image and thumbnail).
I resize the picture to the recommended dimensions, but it never seems to actually resize the picture in the box. And that's for all of them, the slider, thumbnail and featured image.
I toy with the dimensions to try to learn whats happening, but it just doesn't make sense to me, the box just zooms further into the image, the image doesn't actually move or try to fit at all when the dimensions are changed.
They also share the same image for the featured image and thumbnail, even if i click 'thumbnail only' and change the dimensions, it effects all of the images.
The slider images are always cut off, even if i change to the recommended dimensions. I've given up with the slider after a week of resizing, trying new sliders, adding slider codes into .php, enough.
But now this issue with a simple featured image and thumbnail is the last straw. So here it is, my cry for help!
How can i get control of my images, resize effectively, so i dont get these issues every time i try to add images into various functions.
Any help is much appreciated, thanks.

My logo is not sharp in wordpress

My logo (which actually only contains my name ) on my wordpress twenty sixteen child theme site is not completely sharp. I have tried everything like higher resolution uploading in jpg, png or svg. Nothing helped.
I didn't use site title instead of a logo because I don't want to use too many different font families since this might slow down my site. And also I think the font family 'skia' I'm using is not very common so that could make even loading worse.
Hope someone can help me on this. Or correct me if my findings are not correct.
Hazy
It could be that the CSS of your theme is resizing the image. Or maybe you have a plug-in that automatically compresses images on upload.
if this is still relevant, i have come across the solution.
i had the same issue
no matter what logo i made or even text only it had some blurry effect
the key to this is when you export your logo (in Photoshop for ex), set the height and width to the desired size, and set the same height and width in the Wordpress customizer as well.
in my case i have made my logo in PNG at the size of 500x200 and exported it to 200x80PX
in Wordpress im using OceanWp as a theme, this allows you to set the height and width of your logo inside the settings of the customizer.
so basically set it to 200x80 and your good to go
my logo contains only text and a square
my logo now looks sharp as the sky :)

Uploaded images cut off

I have a problem with new images. When I'm uploading a new image it looks like this:
Any suggestions how to fix this ?
I ran into this problem. Every time I added an image into a page, part would be cropped off. I tried playing with the settings > media etc, turned off the Smush plugin, changed the image size and dimensions in photoshop. But part of the image still kept getting trimmed off when uploading. Finally, I uploaded the image directly into Media, where it looked fine. Tried placing it in the page - cut off again. Copied and pasted the image code into the page and it shows up fine. I haven't nailed down the issue, but at least this is a workaround if it is only one or two problematic images.
If your problem is that img is cut at the top or/and at the bottom, you probably have a hard crop in your template.
This might help you
Or, try a work around:
Add a high-quality, max-height image, then you can and scale it up with transform: scale(1.5); in css.
Hope that helps.
If you go to Settings -> Media, you should set width or height to 0. In this way, that dimension will be scaled and nothing is cut off.
If you set width to 0, vertical (height > width) images will be reduced, and horizontal images will be enlarged a bit.
Go to settings > media and you will see your image settings. What is happening is that the image you are uploading is too large and thus it gets cropped. Uncheck Crop thumbnail to exact dimensions (normally thumbnails are proportional), and your images will get scaled rather than cropped.
If this is still no good to you, then you will have to jump into the code that is displaying the images.

Image grid on website, can I scale images down with CSS?

I have a lot of images with a resolution around 500x1500 and I want to show all those images in a grid on my website. Each picture in the grid should be 200x200px.
If I scale down the images with CSS from 500x1500px to 200x200px and I show 10 200x200px images on my website, does this mean that the visitor first have to download the 500x1500px images and then their browser scales the pictures down?
If that is the case, then it's a bad solution to do it like this, right? Instead I should have two versions of each picture, one 500x1500px version and one 200x200px version. Am I right?
The question then is what's the easiest way to scale down hundreds of images?
Yes, I think it is the case that the browser will download the larger image and then scale it. You can check for yourself by opening the dev tools on the browser (press F12 if you're using Chrome) and monitoring the network traffic when you reload your site.
The easiest way to scale down hundreds of images is find or write a program to do it.
You are right. You can set height and width of the images but 1) the user will have to download a bigger image than necessary and 2) the height x width ratio will be trouble (the big one is 1x3 and the small one is 1x1). I would either use http://www.imagemagick.org/ , gimp or a similar tool to crop the images, but the problem is that the cropped area might not be very good. Only a human can select a good fit for the cropped area :-(
Edit1: Perhaps a well-trained neural network could select the most "interesting" part of every image programatically but that's kind of a lot of trouble to do that. Still it could be pretty interesting :-)

Banner image being cropped

I'm trying to add images to a banner that was included with the WordPress template I'm using, but it's cropping the images instead of scaling them properly.
I noticed that the height of the banner was too small, but I can't seem to be able to change it in the CSS code.
This is the page where I'm trying to sort out the banner - Money Matters Home, and this is the original image that I uploaded - home-banner-1.png
As you can see, it's being cropped from the original, despite the fact that I've tried to change the height of the banner. The original image dimensions are 900 x 278, and it should scale naturally to 1152 x 355, but isn't.
Does anyone know how to sort this out? I feel like I'm missing something really obvious here!
You could just re-size the image in Photoshop or Gimp to the exact dimensions of the WordPress header.
Use your browsers developer inspect tool to figure out the exact dimensions.
Change dimensions of your image first to 870x230 (as i see the dimensions of current banner) - you can do it in Photoshop or even Paint.
Then when you upload image in Wordpress via Uploader, Upload the Image file and Select "Original" option in Size of image before saving rather than small/medium/large etc
Your current image banner file is: http://bojomedia.co.uk/preview/moneymatters/wp-content/uploads/2013/08/home-banner-1-temp-870x230.png
note 870x230 at the end of that file name - This is wordpress generated cropped version of original file that's being used there.
I hope this helps.

Resources