Charlie's Content install and use

On this page... (hide)

  1.   1.  Initial statement
  2.   2.  installing Charlie's Contents
  3.   3.  Charlie's Contents config
  4.   4.  Using Charlie's
  5.   5.  Scripts
    1.   5.1  mp4
    2.   5.2  PDF

This page is to help people install and use the Piwigo Charlie's content plugin.

1.  Initial statement

I'm french, writing in English may lead to some misunderstanding, I beg you pardon :-(. As far as I know, Charlie's contents works perfectly for any document or media file it's aimed to, whatever Piwigo version you use and whatever the plugin management says, as far as it's correctly installed. I'm not really a programmer and not at all familiar to the CVS/SVN/GIT stuff, so the only reliable way to get Charlie's is to download the last zip file.

I only myself use ftp/sftp/fish, that is direct file transfer to real galleries. I know, because peoples say so that Charlie's works also on files uploaded by other ways, but can't make any promise.

2.  installing Charlie's Contents

Get the latest version by clicking on the "download" button, or on red down arrow here:

http://piwigo.org/ext/extension_view.php?eid=119

should be a zip file !

To use Charlie's, you have to get access to the piwigo/plugin folder. Filezilla is a good way to transfer files, but I use Dolphin or gftp as well The simpler way to have a working system is to unzip the Charlie's zip file anywhere and transfert all the content to the plugin folder, to get this result:

3.  Charlie's Contents config

There is no more any config interactive page. As you need to be the Piwigo admin to install Charlies, you can as well config it by editing the config files.

Files relevant are "charlies_config.php" and the "tpl" file for your document format. As you see on the image, pdf document tpl is charlie_acrobat.tpl.

So you won't have a charlie's entry in the plugin menu (you have one in the plugin list).

Final display of documents depends not of Charlies, but mostly on the document driver...

4.  Using Charlie's

More up to date instructions may be (or not :-) available in the charlie's README-FIRST.TXT file.

At leat from 2.8.6 (but may be before), the Piwigo gallery include/category_default.inc.php file have a line:

$conf['upload_form_all_types'] = false;

That prevent loading of non image files. I don't use native piwigo uploading way usually, but ftp, so for me this is not a problem, but if you want to use native piwigo way, you may have to change in this line "false" to "true":

$conf['upload_form_all_types'] = true;

Best done in local file editor plugin, now default.

Charlie' contents try to add to Piwigo the ability to display many other files formats, namely:

  • Video files (flv, mp4, mov) (notice flv is deprecated because unsecure)
  • Audio files (mp3)
  • GPS files (gpx)
  • pdf files (pdf)
  • archive files (zip)

If you know of a _simple_ free reader for other kind of files, please let me know.

Some files (like video files) can be extremely difficult to display in "any" browser. One have to test Windows (any flavor), Mac, Linux, Android, Iphones and tablets... I can't even try many of these devices, if you have one, please report the working for you.

At the beginning, Charlie's contents aimed to use much more file formats, but it proved impossible to have then in all browsers without recoding (like Youtube do), and it's mostly not possible for our users.

So, when I was the new maintainer (because the previous ones didn't want anymore to keep the task), my first goal was to make the code simpler. I'm absolutely not a programmer, only a hacker, so every time I didn't know exactly what to do I kept the code as it was, so some pages keep too much complex to our use, but if it's not broken don't fix it...

I also wrote for my own use some script that gives working video files (for example), I will share them here. For html5, for example, mp4 should work every where. Alas it's not. Some kind of mp4 works for one browser but not in the other. The Handbarke script copied here should works everywhere.

Flash (AKA Adobe flash plugin) do not anymore works on Linux - in fact it's no more updated and the old still compatible version is no more secure, so many Linux distributions chose not to provide it anymore. Everybody should go to html5, but even Windows 7, not so old, do not read it by default...

5.  Scripts

My scripts are Linux scripts, Windows one shouldn't be so different. They are to give files ready to be uploaded by ftp to piwigo "galleries" folder.

5.1  mp4

mp4 script. This script do not build the thumbnails, you can add the lines from the previous script if you want. The Handbrake line have to be all on only one line, with no line break. It's only the same one as the graphical interface of Handbrake, preset iphone and ipod touch, and with the option "web optimized"

#!/bin/bash
# echo usage: movtopiwi.sh *.mp4

detox -s utf_8 * # clean file name (http://detox.sourceforge.net/)

rep=$(basename `pwd`) ; # name of upper folder
mkdir $rep ; # rep for new video files
mkdir $rep/pwg_representative ; #rep for thumbnails
for a ; do # loop through files given on command line
	b=`echo "$a" | cut -d'.' -f1` ; # file name
# in next line loudnorm normalize the sound, you may want not do do this
	ffmpeg -i $a -af loudnorm -ar 44100 -b:v 1000k -movflags faststart  $rep/$b.mp4 ; # html5 mp4
	ffmpeg -i $a -r 1 -t 00:00:01 -ss 0:0:05 -s 1920x1080 -f image2 $b.jpg ; # extract one image à 1s from the beginning
	convert -resize 128x128 $b.jpg $rep/pwg_representative/$b.jpg ; # thumbnail
	rm $b.jpg ;
done
exit

5.2  PDF

#!/bin/bash
# echo usage: piwi-imagettes.sh fichiers-pdf

mkdir pwg_representative ;	

for a ; do

detox -v -s utf_8 "$a"

b=`echo "$a" | cut -d'.' -f1` ; # nom du fichier sans extension
gs -q -dNOPAUSE -dBATCH -sDEVICE=jpeg -dJPEGQ=95 -r150x150 -dFirstPage=1 -dLastPage=1  -sOutputFile=pwg_representative/$b.jpg "$a" # crée le jpg

magick   pwg_representative/$b.jpg -resize 128x128 -pointsize 20 -draw "gravity south fill black  text 0,12 'PDF' fill white  text 1,11 'PDF' " pwg_representative/$b.jpg # ajout de n"PDF" par dessus

done