What can Pimcore do?

Why we developers love Pimcore so much – and why you will love it too

We've already written a lot about Pimcore, so I won't mention much of this information anymore. With this article I want to enrich you with further contents and link to additional and interesting pages. This article is rather of a technical nature and therefore intended for programmers and people interested in technology.

What makes Pimcore so powerful?

The objects (PIM) in Pimcore are one of the most powerful functions of this system. They are able to create complex data structures in a visual environment easily, understandably and above all dynamically, without having to make any adjustments in the database.

I will show you this with an example. After naming an object class, Pimcore provides you with tools for design and construction. The «layout components» help to create logical structures so that the objects can be created and edited in a user-friendly interface. The «data components» are building blocks that hold the actual data.

Once the object class has been created, data in the objects can be imported or entered manually. The following video shows how to enter data manually.

It was that simple.

© giphy.com

Importing is also not a witchcraft, because Pimcore provides a simple API that allows us developers to store data in objects.

$newObject = new DataObject\Myclassname();
$newObject->setKey(\Pimcore\File::getValidFilename('New Name'));
$newObject->setParentId(123);
$newObject->setName('New Name');
$newObject->setDescription('Some Text');
$newObject->save();

In order to use this API more efficiently, there are already many extensions that will make our developers' hearts beat faster.

One of my favorites are the ImportDefinitions. This bundle can be found on our GitHub profile and can be used free of charge - completely in Pimcore's OpenSource motto.

We set a high value on creating a simple interface with maximum benefit. With a simple mapping, data can be linked to the object.

Reading CSV, JSON, XML and SQL is part of the standard ImportDefinitions program and is available without additional program code. However, with a little programming effort, further formats can be imported and additional functions can be used.

As you can see, I haven't even started yet, but I've already shown some cool functions. Details about the API can be found in the Pimcore developer documentation.

Further to mention is the object inheritance. This means that any child object can inherit the data from the parent object. This reduces the effort for data acquisition and simplifies the reading of the information.

Already the objects in their standard functions leave nothing to be desired. But if you then apply some programming tricks or use one of the many bundles, there are no limits to the possibilities.

There is so much more you could write about Pimcore objects alone. But I would like to hold back a bit and come to the next Pimcore area: Digital Asset Management.

I hope I was able to introduce the objects a little more closely with this short insight and draw your attention to new development possibilities.

© giphy.com

Assets (DAM)

Pimcore is already a great help in product information management, as we learned in the previous chapter. But what can Pimcore do when it comes to my digital data like pictures, documents and videos?

© pimcore.com
© pimcore.com

This graphic gets to the point pretty well. I'll give you an example: «The marketing manager uploads a high-resolution photo to the Asset Management. Pimcore automatically converts it to the correct size so that it is not displayed on the website in this «monster size» and would have to be loaded forever.»

However, this «correct size» must be defined first. This is possible in the thumbnails.

Here I give the transformation that the output is supposed to deliver – the magic of Imagick helps me. In my view I now call an image with this call:

<?= $asset->getThumbnail('exampleCover')->getHtml(); ?>

Now I get the image in the size I defined in the template in the frontend. Pimcore has created a temporary image file in the background, which corresponds to the according specifications.

You can also configure the image directly in the code by specifying the desired transformers such as size or quality.

<?= $this->image('myImage', [
    'title' => 'Drag your image here',
    'width' => 200,
    'height' => 200,
    'thumbnail' => [
        'width' => 200,
        'height' => 200,
        'interlace' => true,
        'quality' => 90
    ]
]); ?>

API information can also be found in the Pimcore developer documentation. There you will also find a table with the various transformation options.

Now we have the image in the right format, but we all know the problem: Depending on the device and its screen resolution, the images look different. Especially with picture motives with people, heads are often cut off. Also in the case of product photos, the focus should be on the article and not on cropping it. Solutions for this problem are often complicated to implement or not at all within an affordable budget.

But Pimcore wouldn't be Pimcore if it didn't have a convenient solution.

In addition to face recognition, which always focuses on the actor's smile, there is also the option of manually setting a focus point.

For face recognition, a library called "facedetect" is required on the server. With this helper you will always find the perfect cutout in the frontend.

More nice features are the powerful image processing, the possibility to integrate meta information and to define properties.

Each image, object and document is supplemented by a versioning. So you can jump back several versions at any time or prepare work and publish it at a later time thanks to the schedule. This versioning has a decisive advantage for the assets: Imagine you have an update of a price list (PDF) that is used in over 20 places on your website. By simply uploading the new version, it can be updated anywhere in one step.

Another point worth mentioning is working with videos. In the backend you can enter various information about the video. You can also specify the type of video: YouTube, Vimeo, Dailymotion and last but not least your own video files saved in Pimcore.

<section id="campaign_video">
    <?= $this->video('campaignVideo', [
        'width' => 700,
        'height' => 400
    ]); ?>
</section>

Usually only the ID found in the URL is needed to display videos from platforms.

The code can also include other parameters such as automatic playback of a YouTube video.

<section id="campaign_video">
    <?= $this->video('campaignVideo', [
        'width' => 700,
        'height' => 400,
        'youtube' => [
            'autoplay' => 1,
            'modestbranding' => 1
        ],
        'vimeo' => [
            'autoplay' => 1,
            'loop' => 1
        ]
    ]); ?>
</section>

MP4 videos stored in the assets can be included as shown below:

<?= $this->video('myVideo', [
    'thumbnail' => 'example',
    'width' => 400,
    'height' => 300,
    'attributes' => [
        'class' => 'video-js custom-class',
        'preload' => 'auto',
        'controls' => '',
        'data-custom-attr' => 'my-test'
    ]
]); ?>

So-called «thumbnails» can also be defined for videos. However, you don't have as much choice of transformations as for the images.

Pimcore takes care of the rest and prepares the video according to your settings.

Documents

So what do we do with all this data? We want to visualize them now. So far I have talked a lot about data storage and management (PIM and DAM/MAM) and its use, but not about the following visualization.

It's like with a smartphone: While with a smartphone it's the telephoning besides the many features, with Pimcore it's the CMS.

© giphy.com

This is where the documents enter the scene. Documents are the mentioned web pages of the system. With various editable components layouts can be created quickly. You can find a list of them in the Pimcore developer documentation. You don't have to worry about the design of the front- or backend, the system does that for you. Let's take the simple input component at hand:

<?= $this->input('input-container'); ?>

So we have inserted a text field in no time that displays the text in the frontend and provides an input box in the backend. This is how it behaves with the other editable fields. So that we can provide our pages with the necessary flexibility, we use so-called building blocks instead of static layouts. Within these bricks, editables can be integrated and supplemented with own functions.

Let me give you an example of what such own functions can achieve: One of our customers wanted to integrate a webcam on the start page. But in bad weather or at night it should be replaced by a static picture or video. The module does this automatically by comparing the current time with that of sunrise and sunset. In addition, a weather service has been connected to query the weather conditions.

This module can now be used anywhere on the page. So you can write a block once and place it x times. The disadvantage: Theoretically all building blocks can be used so often that the website doesn't have much to do with the initial screen design. Our designer has already tufted his hair a few times - too much flexibility can have a negative effect then.

Besides the «normal» website documents, you can also use snippets, links, e-mails and newsletters to store and display information – and in the case of e-mails and newsletters also to send it. So all assets and objects can be used everywhere and multiple times - be it on the website or in newsletters, even on several different websites, thanks to Pimcore's multisite capability.

conclusion

Unfortunately I have to slowly come to an end – although I was only able to show some of the basic functions. But the important thing is to show you how powerful this system is and how it helps you to manage your data centrally.

With all the described functions you can see why Pimcore is called Pimcore. Originally it was intended for the administration of product data (PIM) and was extended bit by bit continuously. Pimcore can be used in any usage scenario I know – up to now, I haven't found one that the system couldn't cope with.

In my opinion Pimcore is the digital experience platform at its best – it's simply fun to work with it, whether as a programmer or as a user.

Do you have any questions? Write us a comment and we will gladly support you in your project.

Your Comment

Whether constructive criticism, questions due to ambiguities or simply a few words of praise – we thank you already for your comment. After a short check we will publish it.

Share

Back to all blog posts

Optimal images for your website – made easy