?
avatar Milglius
Milglius
11 Feb 2019

Is your feature request related to a problem? Please describe.

Imposible to rotate an image in Joomla core

Describe the solution you'd like

Rotating an image in Joomla

Additional context

avatar Milglius Milglius - open - 11 Feb 2019
avatar joomla-cms-bot joomla-cms-bot - change - 11 Feb 2019
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - labeled - 11 Feb 2019
avatar C-Lodder
C-Lodder - comment - 11 Feb 2019

No, it's not impossible to rotate an image in Joomla.

Please do some CSS research: https://developer.mozilla.org/en-US/docs/Web/CSS/transform-function/rotate

Unless your template has something like this, which is highly unlikely:

* {
  transform: rotate(0) !important;
}
avatar mbabker
mbabker - comment - 11 Feb 2019

And if you're looking for a PHP API see https://api.joomla.org/cms-3/classes/Joomla.CMS.Image.Image.html (don't mind the deprecation notices, those actually need to go away and some refactoring needs to happen, I have another issue on the topic somewhere).

If you're looking for a UI integration for this, the media manager in 4.0 supports it.

Is there anything you missing after this knowledge?

avatar Milglius
Milglius - comment - 11 Feb 2019

Yes thank you for trying to help, maybe its very simple and obviuos but I cant find there I need to insert this code to make it work in Joomla 3.9?

For example If I need to Watermark all the images in articles?

watermark(\Joomla\Image\Image $watermark, integer $transparency = 50, integer $bottomMargin, integer $rightMargin) : \Joomla\Image\Image

Do I need to insert this code in protostar template, in what file of this template or somethere else?

avatar dgrammatiko
dgrammatiko - comment - 12 Feb 2019

@Milglius get this https://github.com/dgrammatiko/imageUploaderHelper

Make all the alterations you need and then all your files will be watermarked or whatever you choose to do there after the upload process.

avatar tapiochre101
tapiochre101 - comment - 13 Feb 2019

@Milglius try the JCE Editor Component. It comes with a very handy image editor that allows you to rotate, resize and crop your images.

Hope this helps.
C


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/23875.

avatar tapiochre101
tapiochre101 - comment - 13 Feb 2019

@Milglius try the JCE Editor Component. It comes with a very handy image editor that allows you to rotate, resize and crop your images.

Hope this helps.
C


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/23875.

avatar Milglius
Milglius - comment - 15 Feb 2019

@mbabker mentioned that one just can use api , but the problem no one knows where to insert this api in joomla

avatar mbabker
mbabker - comment - 15 Feb 2019

The plugin @dgrammatiko linked to demonstrates use of the Image API.

avatar Milglius
Milglius - comment - 15 Feb 2019

so api works only in plugin you cant just paste watermark(\Joomla\Image\Image $watermark, integer $transparency = 50, integer $bottomMargin, integer $rightMargin) : \Joomla\Image\Image in the template ?

avatar mbabker
mbabker - comment - 15 Feb 2019

You can't paste that line as is anywhere, the API documentation doesn't give code examples but some basic documentation of what the method does and its signature which contains what the method expects to receive and what will be returned at the end of it. If you need a practical example, this is one:

use Joomla\CMS\Image\Image;

$imagePath = '/path/to/image.jpg';
$watermarkedImagePath = '/path/to/image-watermark.jpg';

// Get the image type from file properties so we save things correctly
$imageType = Image::getImageFileProperties($imagePath)->type;

// Load image to be watermarked
$image = new Image;
$image->loadFile($imagePath);

// Load image to use as watermark
$watermarkImage = new Image;
$watermarkImage->loadFile('/path/to/watermark.jpg');

// Customize to suit your needs
$transparency = 50;
$bottomMargin = 10;
$rightMargin = 10;

// Apply watermark to image
$image->watermark($watermarkImage, $transparency, $bottomMargin, $rightMargin);

// Save to filesystem
$image->toFile($watermarkedImagePath, $imageType);

This should be done in a plugin listening to a save event, not in your template. The Image API is meant to edit images then save them back into the filesystem, it will be painfully inefficient if you try to watermark an image in your template each time the page is displayed.

avatar mbabker mbabker - change - 15 Feb 2019
Status New Closed
Closed_Date 0000-00-00 00:00:00 2019-02-15 15:16:39
Closed_By mbabker
avatar mbabker mbabker - close - 15 Feb 2019
avatar mbabker
mbabker - comment - 15 Feb 2019

At this point this issue is turning into a user support request, which isn't what this platform is used for. If you need further assistance, please use the forums at https://forum.joomla.org.

Given there is an API in Joomla for plugins to process images, the media manager in 4.0 will have more image editing capabilities, and there are extensions for 3.x to do this type of thing, there isn't any feature request here that isn't already fulfilled either.

avatar Milglius
Milglius - comment - 15 Feb 2019

Thank you for information

Add a Comment

Login with GitHub to post a comment