Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure images are squared by ... #11

Open
bobbingwide opened this issue Jul 18, 2018 · 4 comments
Open

Ensure images are squared by ... #11

bobbingwide opened this issue Jul 18, 2018 · 4 comments
Assignees
Labels
enhancement Priority A High priority Severity 2 Medium severity

Comments

@bobbingwide
Copy link
Owner

In archive displays one image is displayed in the hero section then there are multiples of 4 below. The images displayed in the blocks should all be squared. The simplest method would appear to be to use a “post-thumbnail” image size which is rectangular.

Requirements

  • Images displayed in the block to be the same size
  • Automatic creation of the post-thumbnail image

Proposed solution

  • use set_post_thumbnail_size() in response to after_setup_theme
  • see what happens in the block
  • use a batch routine to create the new post thumbnail size for existing images
@bobbingwide bobbingwide added enhancement Priority A High priority Severity 2 Medium severity labels Jul 18, 2018
@bobbingwide bobbingwide self-assigned this Jul 18, 2018
@bobbingwide
Copy link
Owner Author

bobbingwide commented Jul 18, 2018

Using set_post_thumbnail_size( 1024, 1024, true ); and setting the Genesis Theme Option for Featured Image size to 'post-thumbnail' ensures we see images cropped to squares in the block.

Now I have to decide what I want for the hero and on the single bigram page.
Answer: Square on the hero page. Full size on the single bigram page.

@bobbingwide
Copy link
Owner Author

OK. So it appears to work nicely for new image which are larger than 1024 pixels in each direction.
But I can't get wp media regenerate to work.

Unexpected output

wp media regenerate 1997
Found 1 image to regenerate.
Warning: Can't find "Soft Baked" (ID 1997).
Error: No images regenerated (1 failed).

@bobbingwide
Copy link
Owner Author

Attempting to use regenerate-thumbnails plugin gives a little more detail as to the possible cause of the problem.

"Soft Bank" (ID 2474) failed to resize. The error message was: The originally uploaded image file cannot be found at C:\apache\htdocs\bigram/wp-content/uploads/http://www.bigram.co.uk/wp-content/uploads/2016/07/Soft-Bank.jpg

Need to find where it's getting http://www.bigram.co.uk/wp-content/uploads

@bobbingwide
Copy link
Owner Author

bobbingwide commented Jul 18, 2018

Updating regenerate-thumbnails from 2.2.6 to 3.1.0 ( GitHub version ) gives

<b>Warning</b>:  filemtime(): stat failed for 
C:\apache\htdocs\wordpress\wp-content\plugins\regenerate-thumbnails/dist/build.js in <b>
C:\apache\htdocs\wordpress\wp-content\plugins\regenerate-thumbnails\regenerate-thumbnails.php</b>
on line <b>195</b><br /> 

using the built version from wordpress.org helped a bit
ERROR: The fullsize image file cannot be found in your uploads directory at https://qw//bigram/wp-content/uploads/2016/06/Soft-Baked.jpg. Without it, new thumbnail images can't be generated.

It appears that the values for _wp_attached_file are URLs not relative file names.

This is true for files uploaded in 2016/06.

Once resolved the cropping still doesn't do what we want, which is to force the image to be square.
Basically we want the biggest square image.

bobbingwide added a commit that referenced this issue Jul 24, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Priority A High priority Severity 2 Medium severity
Projects
None yet
Development

No branches or pull requests

1 participant