Code Monkey home page Code Monkey logo

froshplatformthumbnailprocessor's Introduction

Thumbnail Processor for Shopware 6

Software License Shopware Store

This plugin allows you to use variable thumbnails, if your filesystem (or storage-adapter) supports it. So you don't need modern file formats.
Besides the benefits for using it in live shops, you can use this also in development-systems, if you don't want thumbnails to be created.
It will add parameters to original image paths.
So you are able to save storage and add new thumbnails on the fly.

Plugin version Shopware version Branch
5.* Min. 6.6 main
4.* - 3.0.0 Min. 6.5 v4
2.* - 1.0.16 Min. 6.4 v2
1.0.15 - 1.0.6 Min. 6.3
1.0.5 - 1.0.0 Min. 6.0

Install

Download the plugin from the release page and enable it in Shopware.

By composer

composer require frosh/platform-thumbnail-processor

From source

Run npm install in src/Resources/app/storefront within the plugin directory

By zip

download latest release and upload into admin: https://github.com/FriendsOfShopware/FroshPlatformThumbnailProcessor/releases/latest/download/FroshPlatformThumbnailProcessor.zip

Usage

While active, this will access all thumbnails variable from original image. The thumbnail-files won't be needed anymore.

e.g.:
https://www.example.com/thumbnail/01/82/69/sasse_200x200.png
 becomes:
https://www.example.com/media/01/82/69/sasse.png?width=200

You can edit the thumbnail-template within the plugin-config. Defaults {mediaUrl}/{mediaPath}?width={width}. Available variables with examples:

  • {mediaUrl}: https://www.example.com/
  • {mediaPath}: media/01/82/69/sasse.png
  • {width}: 800
  • {mediaUpdatedAt}: 1716882050 (unix timestamp) or 0

Feel free to decorate ThumbnailUrlTemplateInterface to add more individual functions like signed imgproxy

Removing unneeded thumbnails

You may want to delete folder thumbnails within folder public. If needed, you could create redirects on your web server for old paths. Example for Apache .htaccess: RewriteRule ^thumbnail/(.*)_\d+x\d+.(.*)$ https://cdn.myshop.com/media/$1.$2 [L,R=301], consult their docs for more details.

Adding more thumbnail sizes:

  • Save new size in the folder of the media management
  • (no more needed from version 3.0.2) run the command bin/console media:generate-thumbnails on the console to update the thumbnails for all images in the database
  • Clear shop cache

Find Patterns

You can find patterns in GitHub Discussions in category Patterns

Uninstall

After uninstalling plugin you have to run bin/console media:generate-thumbnails -strict to generate the thumbnails-files on disk.

License

The MIT License (MIT). Please see License File for more information.

froshplatformthumbnailprocessor's People

Contributors

tinect avatar aragon999 avatar shyim avatar stefanpoensgen avatar lx-wnk avatar xyng avatar wysselbie avatar faddafrank avatar wexollm avatar isengo1989 avatar stephan4p avatar haarhoff-frs avatar imgbot[bot] avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.