README.md

# Sac-Thumbnails #

Processo em Elixir para criação de Thumbnails de imagens, vídeos, pdf e Arquivos Office

## Requisitos: ##

    * <a href="imagemagick7">ImageMagick</a> (Para tratamento de imagens e PDFs) 
    * FFMPEG      (Para tratamento de vídeos)
    * libreoffice (Para tratamento de arquivos office)
    * chrome instalado e com alias "chrome" adicionado ao $Path

## Instalação: ##

Add this to your `mix.exs` file, then run `mix do deps.get, deps.compile`:

``` elixir
{:sac_thumbnails, "~> 0.2.6"},
```

## Como usar: ##

Importe a biblioteca para seu modulo

``` elixir
import SacThumbnails
```

Chame a função create_thumb/3

``` elixir

```

A função espera um atom que representa o tipo de arquivo:

``` elixir
(:image | :video | :pdf | :docs | :link) # ( :docs -> Arquivos do Pacote Office)
```

e um keyword string com parametros de origem e destino, assim como opcionais de dimensinamento e forma:

``` elixir

    filename,
    to_path #(diretório de destino do arquivo. Ele precisa existir previamente),
    :width #(largura da thumb, se for omitido será usado valor 200 por padrao),:height #(altura da thumb, se for omitido será usado valor 200 por padrao)
}
```

## Exemplo ##

``` elixir 
SacThumbnails.create_thumb(:image, %{filename: "/home/arcanjo/Documentos/elixir/sacdigital-thumbnails/priv/the-dark-angel-hd-wallpaper-hd-1080p.jpg", to_path: "teste/", width: 150, height: 150})
```

## Instalando ImageMagick ## <id= "imagemagick7">
#### Centos 7 ####
Installing ImageMagick from Repository
First, install following prerequisite php-pear, php-devel and gcc packages to compile the Imagick PHP extension.

``` shell
# yum install php-pear php-devel gcc
```

Once you’ve installed php-pear, php-devel, and gcc packages, you may now install ImageMagick software for PHP and Perl support using yum command.

``` shell
# yum install ImageMagick ImageMagick-devel ImageMagick-perl
```

https://linuxize.com/post/how-to-install-ffmpeg-on-centos-7/

1 The Nux repository depends on the EPEL software repository. If the EPEL repository is not enabled on your system, enable it by typing:

``` shell
sudo yum install epel-release
```

2 Next, import the Repository GPG key and enable the Nux repository by installing the rpm package:

``` shell
sudo rpm -v --import http://li.nux.ro/download/nux/RPM-GPG-KEY-nux.ro
sudo rpm -Uvh http://li.nux.ro/download/nux/dextop/el7/x86_64/nux-dextop-release-0-5.el7.nux.noarch.rpm

```

3 Once the repository is enabled, install FFmpeg:

``` shell
sudo yum install ffmpeg ffmpeg-devel
```

4 Verify the FFmpeg installation by running the ffmpeg -version command:

``` shell
ffmpeg -version
```