Skip to content

Add image library support data. #98

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions parts/single-result.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,13 @@
<td><strong>Extensions</strong></td>
<td><?php echo esc_html( Display::get_display_extensions( $report->ID ) ); ?></td>
</tr>
<tr>
<td><strong>Image Libraries</strong></td>
<td><strong>GD</strong></td>
<td><?php echo esc_html( Display::get_display_gd_image_support( $report->ID ) ); ?></td>
<td><strong>Imagick</strong></td>
<td><?php echo esc_html( Display::get_display_imagick_image_support( $report->ID ) ); ?></td>
</tr>
</table>

<?php
Expand Down
41 changes: 41 additions & 0 deletions src/class-display.php
Original file line number Diff line number Diff line change
Expand Up @@ -406,4 +406,45 @@ private static function pagination( $query ) {

}

/**
* Get the GD image support for display.
*
* @param integer $report_id Report ID.
* @return string
*/
private static function get_display_gd_image_support( $report_id ) {
$env = get_post_meta( $report_id, 'env', true );
if ( empty( $env['gd_info'] ) ) {
return 'unavailable';
}

$output = '<ul class="ptr-test-reporter-list">';

foreach ( $image_data as $key=>$data_point ) {
$output .= sprintf( '<li>%s: %s</li>', esc_html( $key ), esc_html( $value ) );
}

$output .= '</ul>';
return $output;
}

/**
* Get the Imagick image support for display.
*
* @param integer $report_id Report ID.
* @return string
*/
private static function get_display_imagick_image_support( $report_id ) {
$env = get_post_meta( $report_id, 'env', true );
if ( empty( $env['imagick_info'] ) ) {
return 'unavailable';
}

$output = '<ul class="ptr-test-reporter-list">';

$output .= sprintf( '<li>Supported formats: %s</li>', implode( ', ', $env['imagick_info'] ) );

$output .= '</ul>';
return $output;
}
}