HEX
Server: Apache
System: Linux belinyu.iixcp.rumahweb.net 4.18.0-553.123.2.lve.el8.x86_64 #1 SMP Thu May 7 23:17:13 UTC 2026 x86_64
User: sduw1495 (3615)
PHP: 7.4.33
Disabled: system,exec,escapeshellarg,escapeshellcmd,passthru,proc_close,proc_get_status,proc_nice,proc_open,proc_terminate,shell_exec,popen,pclose,dl,pfsockopen,leak,apache_child_terminate,posix_kill,posix_mkfifo,posix_setsid,posix_setuid,posix_setpgid,ini_alter,show_source,define_syslog_variables,symlink,syslog,openlog,openlog,closelog,ocinumcols,listen,chgrp,apache_note,apache_setenv,debugger_on,debugger_off,ftp_exec,dll,ftp,myshellexec,socket_bind,mail,posix_getwpuid
Upload Files
File: /home/sduw1495/public_html/wp-content/plugins/image-optimization/classes/image/image-dimensions.php
<?php

namespace ImageOptimization\Classes\Image;

use ImageOptimization\Classes\Logger;

use Imagick;
use stdClass;
use Throwable;

if ( ! defined( 'ABSPATH' ) ) {
	exit; // Exit if accessed directly.
}

class Image_Dimensions {
	/**
	 * @param string $file_path
	 *
	 * @return stdClass{width: int, height: int}
	 */
	public static function get_by_path( string $file_path ): stdClass {
		$dimensions = wp_getimagesize( $file_path );
		$output = new stdClass();

		$output->width = 0;
		$output->height = 0;

		if ( $dimensions ) {
			$output->width = $dimensions[0];
			$output->height = $dimensions[1];

			return $output;
		}

		if ( class_exists( 'Imagick' ) ) {
			try {
				$im = new Imagick( $file_path );
				$image_geometry = $im->getImageGeometry();
				$im->clear();

				$output->width = $image_geometry['width'];
				$output->height = $image_geometry['height'];
			} catch ( Throwable $t ) {
				Logger::log(
					Logger::LEVEL_ERROR,
					'AVIF image dimensions calculation error: ' . $t->getMessage()
				);
			}
		}

		return $output;
	}
}