2017 © Pedro Peláez
 

elgg-plugin hypeicons

Interface for uploading and cropping entity icons and covers

image

hypejunction/hypeicons

Interface for uploading and cropping entity icons and covers

  • Wednesday, April 19, 2017
  • by hypeJunction
  • Repository
  • 1 Watchers
  • 0 Stars
  • 21 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 1 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

hypeIcons

Interface for uploading and cropping entity icons and covers, (*1)

Elgg 2.2, (*2)

Features

  • Generic API for uploading, handling and cropping entity icons and covers
  • Admin settings to enable icons/covers for all entity types
  • Allows to crop file thumbnails
  • Allows to crop user and group avatars and cover images
  • An option switch between square, rounded and circle entity icons
  • An option to replace default entity icons with SVG
  • An option to replace default filetype icons with SVG
  • Responsive icon/cover cropping

Screenshots

Icon/Cover Cropper Layout with cover, (*3)

Notes

Default entity type icons

To replace a default entity icon/cover, simply place an image in views/default/<icon_type>/<entity_type>/<entity_subtype>.<ext>, where: - ext is either svg, png, gif or jpg. - icon_type is either cover or icon, (*4)

Add a cropper as a form input

// in your form
echo elgg_view('input/cropper', array(
    'src' => 'http://example.com/uri/image.jpg',
    'ratio' => 16/9,
    'name' => 'crop_coords',
));

// in your action
$coords = get_input('crop_coords');

Add cropper to a file input

This will allow users to crop an image before uploading it to the server., (*5)

// in your form
echo elgg_view('input/file', array(
    'name' => 'avatar',
    'use_cropper' => true,
));

// in your action
$coords = get_input('crop_coords');

You can as well pass preset coordinates and images source., (*6)

// in your form
echo elgg_view('input/file', array(
    'name' => 'cover',
    'use_cropper' => array(
        'name' => 'cover_crop_coords',
        'ratio' => 16/9,
        'src' => '/uri/image.jpg', // previously uploaded file
        'x1' => 100,
        'y1' => 100,
        'x2' => 260,
        'y2' => 190,
    ),
));

// in your action
$coords = get_input('cover_crop_coords');

In your action, be sure to use the same image source for cropping. If you passed master image source to the file input, you will need to implement the logic for both new file upload and master image, as cropping coordinates may change even without new file upload., (*7)

Displaying a cover image

echo elgg_view('output/cover', [
   'entity' => $entity,
]);

Adding cover image in layout header

```php echo elgg_view_layout('one_sidebar', [ 'entity' => $entity, 'show_cover' => true, 'title' => 'Page with cover', 'content' => 'Page content', ]);, (*8)

The Versions

19/04 2017

dev-master

9999999-dev http://hypejunction.com

Interface for uploading and cropping entity icons and covers

  Sources   Download

GPL-2.0

The Requires

 

by Ismayil Khayredinov

plugin icon avatar elgg cropper cover

19/04 2017

1.0.0

1.0.0.0 http://hypejunction.com

Interface for uploading and cropping entity icons and covers

  Sources   Download

GPL-2.0

The Requires

 

by Ismayil Khayredinov

plugin icon avatar elgg cropper cover