Spamworldpro Mini Shell
Spamworldpro


Server : Apache
System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64
User : corals ( 1002)
PHP Version : 7.4.33
Disable Function : exec,passthru,shell_exec,system
Directory :  /home/corals/mets.corals.io/wp-content/plugins/ultimate-blocks/src/blocks/post-grid/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/corals/mets.corals.io/wp-content/plugins/ultimate-blocks/src/blocks/post-grid/image.js
/**
 * Post grid featured image.
 */

const { addQueryArgs } = wp.url;
const { apiFetch } = wp;
import { useEffect, useState } from "react";

export default function FeaturedImage(props) {
	const [stillMounted, setStillMounted] = useState(false);
	const [imageUrl, setImageUrl] = useState("");

	useEffect(() => {
		setStillMounted(true);

		return () => setStillMounted(false);
	}, []);

	useEffect(() => {
		if (stillMounted) {
			apiFetch({
				path: addQueryArgs("/wp/v2/media/" + props.imgID),
			}).then((image_data) => {
				let imageUrl = image_data?.media_details?.sizes["full"]?.source_url;

				if (imageUrl) {
					setImageUrl(imageUrl);
				}
			});
		}
	}, [stillMounted]);

	const { postImageWidth, preservePostImageAspectRatio, postImageHeight } =
		props.attributes;

	return (
		<img
			style={{
				width: postImageWidth,
				...(!preservePostImageAspectRatio && { height: postImageHeight }),
			}}
			src={imageUrl || props.imgSizeLandscape}
			alt="img"
		/>
	);
}

Spamworldpro Mini