$81 GRAYBYTE WORDPRESS FILE MANAGER $15

SERVER : premium201.web-hosting.com #1 SMP Wed Mar 26 12:08:09 UTC 2025
SERVER IP : 104.21.43.35 | ADMIN IP 216.73.216.157
OPTIONS : CRL = ON | WGT = ON | SDO = OFF | PKEX = OFF
DEACTIVATED : mail

/var/softaculous/sitepad/editor/site-data/plugins/pagelayer/js/react/src/components/

HOME
Current File : /var/softaculous/sitepad/editor/site-data/plugins/pagelayer/js/react/src/components//multi-image.js
import { LabelControl } from './label';
import { __ } from '@wordpress/i18n';
import { MediaUpload } from '@wordpress/block-editor';
import { useState, useRef, useEffect } from '@wordpress/element';

export const MultiImageControl = (props) => {
	
	const { prop, label, value, setAttributes, attributes, allow = ['image'] } = props;
	const { name } = prop['c'];
	const tmpAtts = attributes?.tmpAtts ?  attributes.tmpAtts : {};
   
	const [imageIds, setImageIds] = useState([]);
	const [imageUrls, setImageUrls] = useState({});
   
	const onSelectImage = (images) => {
		
		var ids = [];
		var urls = {};
		var img_urls = {};
		var titles = {};
		var links = {};
		var captions = {};
		
		for(var i in images){
			
			const { id, url, title, link, caption, sizes} = images[i];
			var _id = 'i'+id;
			
			ids.push(id);
			urls[_id] = url;
			
			//get title
			titles[_id] = title;
			links[_id] = link;
			captions[_id] = caption;
			
			// Create a URL
			img_urls[_id] = {}
			
			for(var x in sizes){
				img_urls[_id][x] = sizes[x].url;
			}
		}
			
		setImageUrls(urls);
		setImageIds(ids);
		
		const tmp = {
			...tmpAtts,
			[name+'-urls']: urls,
			[name+'-all-urls']: img_urls,
			[name+'-all-titles']: titles,
			[name+'-all-links']: links,
			[name+'-all-captions']: captions,
		};
		
		setAttributes({
			[name]: ids,
			tmpAtts: tmp
		});
	}

	useEffect(() => {
		
		var ids = [];
		
		// Any IDs ?
		if(!pagelayer_empty(prop.c['val'])){
			ids = prop.c['val']
			if(pagelayer_is_string(ids)){
				ids = prop.c['val'].split(',');
			}
			//console.log(ids);
			
			setImageIds(ids);
		}
				
		// Query the media library for media items with the specified post IDs.
		wp.media.query({ post__in: ids }).more().then(() => {
			
			var urls = {};
			for(var x in ids){
				var fetch_url = wp.media.attachment(ids[x]).get('url');
				urls['i'+x] = fetch_url;
			};
			
			setImageUrls(urls);
		});
	}, []);

	const renderMediaUploader = (open) => {
		
		return (
			<div className="pagelayer-elp-multi_image-div">
				<center>
					<button 
						className="pagelayer-elp-button"
						onClick={() => open() }
					>
					{ __('Add Images') }
					</button>
				</center>
				<div className="pagelayer-elp-multi_image-thumbs" onClick={ () => open() } >
					{ imageUrls && Object.keys(imageUrls).map((imageName) => (
						<div 
							className="pagelayer-elp-multi_image-thumb"
							style={{
								backgroundImage: `url(${imageUrls[imageName]})`
							}}
						></div>
					))}
				</div>
			</div>
		);
	}
	return (
		<div className="components-base-control pagelayer-base-control">
			<LabelControl {...props} />
			<MediaUpload
				title="Select Image"
				onSelect={onSelectImage}
				allowedTypes={allow}
				value={imageIds}
				multiple={true}
				gallery={true}
				addToGallery={true}
				autoOpen={true}
				render={({ open }) => renderMediaUploader(open)}
			/>
		</div>
	);
}


Current_dir [ NOT WRITEABLE ] Document_root [ NOT WRITEABLE ]


[ Back ]
NAME
SIZE
LAST TOUCH
USER
CAN-I?
FUNCTIONS
..
--
21 Feb 2026 2.55 AM
root / root
0755
access.js
1.263 KB
18 Feb 2026 11.32 PM
root / root
0644
box-shadow.js
5.699 KB
18 Feb 2026 11.32 PM
root / root
0644
checkbox.js
0.638 KB
18 Feb 2026 11.32 PM
root / root
0644
color.js
4.903 KB
18 Feb 2026 11.32 PM
root / root
0644
datetime.js
0.977 KB
18 Feb 2026 11.32 PM
root / root
0644
dimension.js
1.818 KB
18 Feb 2026 11.32 PM
root / root
0644
filter.js
2.293 KB
18 Feb 2026 11.32 PM
root / root
0644
font_family.js
1.529 KB
18 Feb 2026 11.32 PM
root / root
0644
gradient.js
4.01 KB
18 Feb 2026 11.32 PM
root / root
0644
html-to-react.js
0.231 KB
18 Feb 2026 11.32 PM
root / root
0644
icon.js
5.162 KB
18 Feb 2026 11.32 PM
root / root
0644
image.js
2.26 KB
18 Feb 2026 11.32 PM
root / root
0644
label.js
1.317 KB
18 Feb 2026 11.32 PM
root / root
0644
link.js
7.388 KB
18 Feb 2026 11.32 PM
root / root
0644
media.js
1.905 KB
18 Feb 2026 11.32 PM
root / root
0644
modal.js
1.811 KB
18 Feb 2026 11.32 PM
root / root
0644
multi-image.js
2.964 KB
18 Feb 2026 11.32 PM
root / root
0644
multiselect.js
2.107 KB
18 Feb 2026 11.32 PM
root / root
0644
padding.js
2.134 KB
18 Feb 2026 11.32 PM
root / root
0644
radio.js
0.753 KB
18 Feb 2026 11.32 PM
root / root
0644
rich_text.js
4.202 KB
18 Feb 2026 11.32 PM
root / root
0644
screen-icon.js
1.081 KB
18 Feb 2026 11.32 PM
root / root
0644
select.js
2.181 KB
18 Feb 2026 11.32 PM
root / root
0644
setting-tabs-control.js
1.946 KB
18 Feb 2026 11.32 PM
root / root
0644
slider.js
1.472 KB
18 Feb 2026 11.32 PM
root / root
0644
spinner.js
0.826 KB
18 Feb 2026 11.32 PM
root / root
0644
text-shadow.js
7.212 KB
18 Feb 2026 11.32 PM
root / root
0644
textarea.js
0.677 KB
18 Feb 2026 11.32 PM
root / root
0644
typography.js
17.443 KB
18 Feb 2026 11.32 PM
root / root
0644

GRAYBYTE WORDPRESS FILE MANAGER @ 2025 CONTACT ME
Static GIF