WordPress.org

Make WordPress Core

Opened 2 years ago

Closed 2 years ago

#23019 closed enhancement (duplicate)

Wrong type of image options

Reported by: anatolbroder Owned by:
Milestone: Priority: normal
Severity: trivial Version:
Component: Media Keywords:
Focuses: Cc:

Description

The size icon_h0096 was added via add_image_size function. This is the array we pass to all image manipulation procedures.

Old

array(4) {
["thumbnail"]=> array(3) { ["width"]=> string(3) "240" ["height"]=> string(3) "240" ["crop"]=> string(1) "1" }
["medium"]=> array(3) { ["width"]=> string(3) "720" ["height"]=> string(3) "240" ["crop"]=> bool(false) }
["large"]=> array(3) { ["width"]=> string(4) "2160" ["height"]=> string(3) "720" ["crop"]=> bool(false) }
["icon_h0096"]=> array(3) { ["width"]=> int(96) ["height"]=> int(96) ["crop"]=> int(1) }
}

The type of all options is a showcase for the PHP flexibility. It works, but it’s a waste of resources.

Patched

array(4) {
["thumbnail"]=> array(3) { ["width"]=> int(240) ["height"]=> int(240) ["crop"]=> bool(true) }
["medium"]=> array(3) { ["width"]=> int(720) ["height"]=> int(240) ["crop"]=> bool(false) }
["large"]=> array(3) { ["width"]=> int(2160) ["height"]=> int(720) ["crop"]=> bool(false) }
["icon_h0096"]=> array(3) { ["width"]=> int(96) ["height"]=> int(96) ["crop"]=> bool(true) }
}

Every option has the appropriate type.

Attachments (1)

wrong-type-image-options.diff (1.7 KB) - added by anatolbroder 2 years ago.

Download all attachments as: .zip

Change History (3)

comment:1 @anatolbroder2 years ago

#23009 was marked as a duplicate.

comment:2 @markoheijnen2 years ago

  • Keywords has-patch removed
  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed

Please next time use the same ticket instead of creating a new one.

Also I do think your patch is incorrect since you are now merging the functionality all together. But that is something I'm not sure about since I don't know the size array that well.

Since this patch will inflict the changes on ticket #22100 I'm closing this one as duplicate too

Note: See TracTickets for help on using tickets.