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

display image in better way #607

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Conversation

Akhill2020
Copy link
Contributor

Description: Display event attahcment image in better way by showing image rather then just name and link.
Clickup: https://app.clickup.com/t/86cxwtak1
Before & after: https://www.screenpresso.com/=HG0kuVJR8zzv

@Akhill2020 Akhill2020 requested a review from rosinghal February 21, 2025 17:01
$html .= !empty($attachment['icon']) ? '<img src="' . $attachment['icon'] . '" />' : '';
$html .= '<span>' . $attachment['name'] . '</span>';
if (isset($attachment['mime']) && strpos($attachment['mime'], 'image') !== false) {
$html .= !empty($attachment['icon'])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Worth moving !empty($attachment['icon']) to line 990

$html .= !empty($attachment['icon'])
? '<img src="' .
$attachment['icon'] .
'" style="max-height: 240px;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we please add a class for this instead of inline styling?

@@ -987,8 +987,18 @@ private function get_attachments($attachments)
foreach ($attachments as $attachment) {
$html .= '<li class="simcal-attachment">';
$html .= '<a href="' . $attachment['url'] . '" target="_blank">';
$html .= !empty($attachment['icon']) ? '<img src="' . $attachment['icon'] . '" />' : '';
$html .= '<span>' . $attachment['name'] . '</span>';
if (isset($attachment['mime']) && strpos($attachment['mime'], 'image') !== false) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's move this part to a new shortcode cover_image

@@ -987,8 +987,18 @@ private function get_attachments($attachments)
foreach ($attachments as $attachment) {
$html .= '<li class="simcal-attachment">';
$html .= '<a href="' . $attachment['url'] . '" target="_blank">';
$html .= !empty($attachment['icon']) ? '<img src="' . $attachment['icon'] . '" />' : '';
$html .= '<span>' . $attachment['name'] . '</span>';
if (isset($attachment['mime']) && strpos($attachment['mime'], 'image') !== false) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do test if it does not run on core plugin since we can't have drive access there

$response_arr = json_decode($response, true);

if (isset($response_arr['response']) && !empty($response_arr['response'])) {
if ($response_arr['response']) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems irrelevant condition

];
return $response;
}
$response = [
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need since it will be unreachable code

$send_data = [
'site_url' => self::$my_site_url,
'auth_token' => get_option('simple_calendar_auth_site_token'),
'arguments' => $args,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
'arguments' => $args,
'arguments' => [
'attachments' => $args['attachments']
],

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants