Giter Site home page Giter Site logo

odoo-imagemagick's Introduction

odoo-imagemagick

advanced image management

This module requied a python library called Wand. Install Wand to your machine by using:

$ sudo apt install libmagickwand-dev

$ sudo pip3 install Wand

You need to specify recipes first in your database. By doing that, you can go to "Settings" -> "Configuration" -> "Image Recipe". You can find all Wand methods in http://docs.wand-py.org/en/0.4.1/index.html. And wand document in https://media.readthedocs.org/pdf/wand/0.3-maintenance/wand.pdf

The module includes a http controller class which can take 6 different urls and return the processed image with your recipe.

Here's an example of how to specify a recipe and use it by controller:

You want to resize a photo to maximum size 300px*300px. Your recipe should be: image.transform(resize='300x300>'). Don't forget to publish your recipe after that.

And now you want to resize an employee image to that size by using this http route:

"/website/imagemagick/model/field/id/model("image.recipe"):recipe"

This route takes 4 parameters which are "model name", "field name", "record id", "recipe id"

In this case, you should get your first employee's image to maximum size 300px*300px by using url below:

http://localhost:8069/website/imagemagick/hr.employee/image/1/1

Supported controlers:

Controled url Description
/imagemagick/<attachment_id>/id/<recipe_id> Used to fetch an attachment with an recipe using recipe id.
/imagemagick/<attachment_id>/ref/<recipe_ref> Used to fetch an attachment with an recipe using recipe external reference.
/imageurl/id/<recipe_id>?url=<image_url> Used to apply a recipe on a local image.
/imageurl/ref/<recipe_ref>?url=<image_url> Used to apply a recipe on a local image.
/imagefield/<model_name>/<field_name>/<obj_id>/ref/<recipe_ref> Used to fetch an arbitrary field from a model with a recipe using recipe id.
/imagefield/<model_name>/<field_name>/<obj_id>/id/<recipe_id> Used to fetch an arbitrary field from a model with a recipe using recipe external reference.
/imagefield/<model_name>/<field_name>/<obj_id>/ref/<recipe_ref>/image/<file_name> Used to fetch an arbitrary field from a model with a recipe. Intended to use a file name to ensure unique url.
/website/imagemagick/<model_name>/<field_name>/<obj_hash>/<recipe_id> Similar to the /imagefield/ controlers but designed to use a hash. Primarily meant to make it easier to manage caching.

Variables:

Variable Description Expected type
<attachment_id> id of an attachment. Int
<field_name> Technical name of the field on the model. Str
<file_name> Only used to make url unique. Str
<image_url> Path to the image. Only supports local paths. Str
<model_name> Technical name of the model. Str
<obj_hash> Hash id of the object, also supports id. Str or Int
<obj_id> id of an object from selected model Int
<recipe_id> id of an recipe Int
<recipe_ref> External id of an recipe Str or Int

odoo-imagemagick's People

Contributors

anderswallenquist avatar daerio avatar han-wong avatar haojunzou avatar jakobkrabbe avatar markusjacobsson avatar mikaelatvertel avatar olyrhc avatar robch2342 avatar sandrapettersson avatar simonrundstedt avatar victorekstrom avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

odoo-imagemagick's Issues

[8.0] Could this be used for watermarking images?

Hi,

I've been looking around for a module that might support watermarking of images in Odoo. For my requirements i'll need to serve watermarked images for public users, or specific user groups to brand the images and stop people plagiarizing them.

Is this something this module could accomplish, or be extended to accomplish? Is there anywhere I can find some information on how to use the module? I'd be very interested to see how it works.

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.