Archives
Trending
Support
Login
clear text
XML
Django
JavaScript
MATLAB
C
C++
C#
Python
SQL
Shell
Bash
Markdown
YAML
JSON
HTML
CSS
PHP
Java
Ruby
Go
Rust
Swift
Kotlin
Arduino
TypeScript
Perl
Autohotkey
Lua
SQF
R
Scala
Haskell
Groovy
Dart
Clojure
VB.NET
Objective-C
PowerShell
Bash
CoffeeScript
Verilog
add_filter( 'image_resize_dimensions', function ( $payload, $orig_w, $orig_h, $dest_w, $dest_h, $crop ) { if ( ! $crop || $dest_w <= 0 || $dest_h <= 0 ) { return $payload; } $dest_ratio = $dest_w / $dest_h; $orig_ratio = $orig_w / $orig_h; if ( $orig_ratio > $dest_ratio ) { $src_h = $orig_h; $src_w = (int) round( $dest_ratio * $src_h ); $src_x = (int) floor( ( $orig_w - $src_w ) / 2 ); $src_y = 0; } else { $src_w = $orig_w; $src_h = (int) round( $src_w / $dest_ratio ); $src_x = (int) floor( ( $orig_w - $src_w ) / 2 ); $src_y = 0; } $dst_x = 0; $dst_y = 0; return array( $dst_x, $dst_y, $src_x, $src_y, $dest_w, $dest_h, $src_w, $src_h ); }, 10, 6 );
Mark as private (unlisted)
for 30 minutes
for 6 hours
for 1 day
for 1 week
for 1 month
for 1 year
everlasting (like CCCP)