Skip to content

Commit

Permalink
Feat/image (#42)
Browse files Browse the repository at this point in the history
* fix: image attributes

* feat: update footer privacy policy text
  • Loading branch information
xuliwenwenwen authored Nov 1, 2024
1 parent 1c744ca commit ef2ea5a
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 6 deletions.
6 changes: 6 additions & 0 deletions pingcap-jp/css/components/footer.scss
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,12 @@
}
}

&__links-group-tip {
a {
text-decoration: underline;
}
}

&__legal {
display: flex;
flex-direction: column;
Expand Down
2 changes: 1 addition & 1 deletion pingcap-jp/inc/PingCAP/Components/Footer.php
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ public function render(): void
<input type="email" name="cta_email" placeholder="Enter your email *" aria-label="Enter your email address">
</form>
</div>
<p>サインアップするとTiDBに関する最新情報を受け取ることができます。</p>
<p class="site-footer__links-group-tip">PingCAPの<a href="/privacy-policy/">プライバシーポリシー</a>に同意し、製品、サービス、イベント等に関する連絡を受け取ることを希望します。</p>
<div class="site-footer__social-group">
<?php
foreach ($this->social_links as $item) {
Expand Down
20 changes: 15 additions & 5 deletions pingcap-jp/vendor/dfrei/wp-util/src/Images.php
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ public static function replace_content_with_ib_images(string $content): string
$attr_height = $image_nodes[$i]->getAttribute('height');
$attr_alt = $image_nodes[$i]->getAttribute('alt');
$attr_src = $image_nodes[$i]->getAttribute('src');
$attr_style = $image_nodes[$i]->getAttribute('style');

$class_names = explode(' ', $attr_class);
$wp_image_id = 0;
Expand All @@ -222,15 +223,20 @@ public static function replace_content_with_ib_images(string $content): string
continue;
}

// $image_sizes = self::get_image_sizes_from_acf_object($wp_image_id);
// $ib_sources_str = self::build_ib_sources_string($image_sizes);

if (is_numeric($wp_image_id) && function_exists('acf_get_attachment')) {
$acf_image = acf_get_attachment($wp_image_id);
}

$attributes['src'] = '"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAAABCAQAAACC0sM2AAAADElEQVR42mNkGCYAAAGSAAIVQ4IOAAAAAElFTkSuQmCC"'; // 100x1
$attributes['data-src'] = $acf_image['url'] ?? $attr_src;
$attributes['class'] = '"lazy ' . $attr_class . '"';
$attributes['alt'] = '"' . $attr_alt . '"';
$attributes['title'] = '""';
$attributes = [
'src' => '"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAAABCAQAAACC0sM2AAAADElEQVR42mNkGCYAAAGSAAIVQ4IOAAAAAElFTkSuQmCC"',
'data-src' => '"' . ($acf_image['url'] ?? $attr_src) . '"',
'class' => '"lazy ' . $attr_class . '"',
'alt' => '"' . $attr_alt . '"',
'title' => '""',
];

if ($attr_width) {
$attributes['width'] = '"' . $attr_width . '"';
Expand All @@ -240,6 +246,10 @@ public static function replace_content_with_ib_images(string $content): string
$attributes['height'] = '"' . $attr_height . '"';
}

if ($attr_style) {
$attributes['style'] = '"' . $attr_style . '"';
}

$attributes_str = trim(urldecode(http_build_query($attributes, '', ' ')));

$ib_image_tag = "<img {$attributes_str} />";
Expand Down

0 comments on commit ef2ea5a

Please sign in to comment.