first commit

This commit is contained in:
2025-06-17 11:53:18 +02:00
commit 9f0f7ba12b
8804 changed files with 1369176 additions and 0 deletions

View File

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<extension type="plugin" group="media-action" method="upgrade">
<name>plg_media-action_crop</name>
<author>Joomla! Project</author>
<creationDate>2017-01</creationDate>
<copyright>(C) 2017 Open Source Matters, Inc.</copyright>
<license>GNU General Public License version 2 or later; see LICENSE.txt</license>
<authorEmail>admin@joomla.org</authorEmail>
<authorUrl>www.joomla.org</authorUrl>
<version>4.0.0</version>
<description>PLG_MEDIA-ACTION_CROP_XML_DESCRIPTION</description>
<namespace path="src">Joomla\Plugin\MediaAction\Crop</namespace>
<files>
<folder>form</folder>
<folder plugin="crop">services</folder>
<folder>src</folder>
</files>
<languages>
<language tag="en-GB">language/en-GB/plg_media-action_crop.ini</language>
<language tag="en-GB">language/en-GB/plg_media-action_crop.sys.ini</language>
</languages>
</extension>

View File

@ -0,0 +1,86 @@
<?xml version="1.0" encoding="UTF-8"?>
<form>
<fieldset name="crop" label="PLG_MEDIA-ACTION_CROP_LABEL">
<field
name="crop_quality"
type="number"
label="PLG_MEDIA-ACTION_CROP_QUALITY"
addonBefore="PLG_MEDIA-ACTION_CROP_QUALITY"
min="1"
max="100"
step="1"
default="80"
filter="integer"
/>
<field
type="spacer"
hr="true"
/>
<field
name="crop_x"
type="text"
label="PLG_MEDIA-ACTION_CROP_PARAM_X"
hiddenLabel="true"
addonBefore="PLG_MEDIA-ACTION_CROP_PARAM_X"
addonAfter="px"
pattern="\d*\.?\d*"
/>
<field
name="crop_y"
type="text"
label="PLG_MEDIA-ACTION_CROP_PARAM_Y"
hiddenLabel="true"
addonBefore="PLG_MEDIA-ACTION_CROP_PARAM_Y"
addonAfter="px"
pattern="\d*\.?\d*"
/>
<field
name="crop_width"
type="text"
label="PLG_MEDIA-ACTION_CROP_PARAM_WIDTH"
hiddenLabel="true"
addonBefore="PLG_MEDIA-ACTION_CROP_PARAM_WIDTH"
addonAfter="px"
pattern="\d*\.?\d*"
/>
<field
name="crop_height"
type="text"
label="PLG_MEDIA-ACTION_CROP_PARAM_HEIGHT"
hiddenLabel="true"
addonBefore="PLG_MEDIA-ACTION_CROP_PARAM_HEIGHT"
addonAfter="px"
pattern="\d*\.?\d*"
/>
<field
name="aspectRatio"
type="groupedlist"
label="PLG_MEDIA-ACTION_CROP_PARAM_ASPECT"
hiddenLabel="true"
class="crop-aspect-ratio-options"
default="1.111"
>
<option class="crop-aspect-ratio-option" value="1.111">PLG_MEDIA-ACTION_CROP_PARAM_DEFAULT_RATIO</option>
<option class="crop-aspect-ratio-option" value="">PLG_MEDIA-ACTION_CROP_PARAM_NO_RATIO</option>
<option class="crop-aspect-ratio-option" value="1">1:1</option>
<group label="PLG_MEDIA-ACTION_CROP_PARAM_LANDSCAPE">
<option class="crop-aspect-ratio-option" value="1.25">5:4</option>
<option class="crop-aspect-ratio-option" value="1.3333333333333333">4:3</option>
<option class="crop-aspect-ratio-option" value="1.5">3:2</option>
<option class="crop-aspect-ratio-option" value="1.7777777777777777">16:9</option>
</group>
<group label="PLG_MEDIA-ACTION_CROP_PARAM_PORTRAIT">
<option class="crop-aspect-ratio-option" value="0.8">4:5</option>
<option class="crop-aspect-ratio-option" value="0.75">3:4</option>
<option class="crop-aspect-ratio-option" value="0.6666666666666667">2:3</option>
<option class="crop-aspect-ratio-option" value="0.5625">9:16</option>
</group>
</field>
</fieldset>
</form>

View File

@ -0,0 +1,46 @@
<?php
/**
* @package Joomla.Plugin
* @subpackage Media-Action.crop
*
* @copyright (C) 2023 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
\defined('_JEXEC') or die;
use Joomla\CMS\Extension\PluginInterface;
use Joomla\CMS\Factory;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\DI\Container;
use Joomla\DI\ServiceProviderInterface;
use Joomla\Event\DispatcherInterface;
use Joomla\Plugin\MediaAction\Crop\Extension\Crop;
return new class () implements ServiceProviderInterface {
/**
* Registers the service provider with a DI container.
*
* @param Container $container The DI container.
*
* @return void
*
* @since 4.4.0
*/
public function register(Container $container): void
{
$container->set(
PluginInterface::class,
function (Container $container) {
$plugin = new Crop(
$container->get(DispatcherInterface::class),
(array) PluginHelper::getPlugin('media-action', 'crop')
);
$plugin->setApplication(Factory::getApplication());
return $plugin;
}
);
}
};

View File

@ -0,0 +1,62 @@
<?php
/**
* @package Joomla.Plugin
* @subpackage Media-Action.crop
*
* @copyright (C) 2017 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace Joomla\Plugin\MediaAction\Crop\Extension;
use Joomla\CMS\Application\CMSWebApplicationInterface;
use Joomla\Component\Media\Administrator\Plugin\MediaActionPlugin;
// phpcs:disable PSR1.Files.SideEffects
\defined('_JEXEC') or die;
// phpcs:enable PSR1.Files.SideEffects
/**
* Media Manager Crop Action
*
* @since 4.0.0
*/
final class Crop extends MediaActionPlugin
{
/**
* Load the javascript files of the plugin.
*
* @return void
*
* @since 4.0.0
*/
protected function loadJs()
{
parent::loadJs();
if (!$this->getApplication() instanceof CMSWebApplicationInterface) {
return;
}
$this->getApplication()->getDocument()->getWebAssetManager()->useScript('cropper-module');
}
/**
* Load the CSS files of the plugin.
*
* @return void
*
* @since 4.0.0
*/
protected function loadCss()
{
parent::loadCss();
if (!$this->getApplication() instanceof CMSWebApplicationInterface) {
return;
}
$this->getApplication()->getDocument()->getWebAssetManager()->useStyle('cropperjs');
}
}