5 use Symfony\Component\HttpFoundation\File\UploadedFile;
23 $crop_input = (array)
get_input(
'_entity_edit_icon_crop');
24 if (empty($crop_input)) {
76 $input_cropping_coords = [
83 $diff = array_diff_assoc($input_cropping_coords, $current);
93 $tmp_file = new \ElggTempFile();
94 $tmp_file->open(
'write');
95 $tmp_file->write($master->grabFile());
99 'name' => basename($master->getFilenameOnFilestore()),
100 'type' => $master->getMimeType(),
101 'size' => $master->getSize(),
102 'tmp_name' => $tmp_file->getFilenameOnFilestore(),
103 'error' => UPLOAD_ERR_OK,
125 if (!is_array($file_data)) {
129 $req_fields = [
'error',
'name',
'size',
'tmp_name',
'type'];
130 $keys = array_keys($file_data);
133 if (
$keys !== $req_fields) {
137 return new UploadedFile(
138 $file_data[
'tmp_name'],
Generic action listener to support cropping an existing icon.
prepareUpload(int $entity_guid, string $input_name, string $icon_type)
Prepare a single existing icon for cropping.
arrayToUploadedFile($file_data)
convert $_FILES array to UploadedFile
__invoke(\Elgg\Event $event)
Set inputs required to support cropping an existing icon.
Models an event passed to event handlers.
_elgg_services()
Get the global service provider.
elgg_extract($key, $array, $default=null, bool $strict=true)
Checks for $array[$key] and returns its value if it exists, else returns $default.
get_entity(int $guid)
Loads and returns an entity object from a guid.
elgg_get_uploaded_file(string $input_name, bool $check_for_validity=true)
Returns a single valid uploaded file object.
if(parse_url(elgg_get_site_url(), PHP_URL_PATH) !=='/') if(file_exists(elgg_get_root_path() . 'robots.txt'))
Set robots.txt.