Menu Close

Category: News

Upgrade to the latest version of emoncms 3

by openenergymonitor.org

To upgrade to the latest version of emoncms:

1) Download the latest version and unzip to your chosen server directory

https://github.com/openenergymonitor/emoncms3

Or if you use git, use git clone when installing for the first time:

git clone git@github.com:openenergymonitor/emoncms3.git

and then all you need to call is git pull and it will download and update the latest changes.

Force HTML5 and HD for embedded youtube video

With the quantity of mobile devices that surfing in the net, and the recent news about not flash support on the new devices, the integration of html5 is needed for compatibility.

So, if you want to force HTML5 and HD for an embedded video, you can use this code:

 

<iframe src="http://www.youtube.com/embed/pmPNz8JJCm8?html5=1&vq=hd720"></iframe>

Modify AjaXplorer for show images in browser

If you want that AjaXplorer shows in browser images from generated public links, you can modify  class.fsAccessDriver.php (in Ajaxplorer4.3.3 is under plugins\access.fs\) at about Line 202:

 

AJXP_Controller::applyHook("dl.localname", array($this->urlBase.$selection->getUniqueFile(), &$localName, $this->wrapperClassName));
// $this->readFile($this->urlBase.$selection->getUniqueFile(), "force-download", $localName);
$Nomefile = $selection->getUniqueFile();
AJXP_Logger::debug("trovo l'estensione di ".$Nomefile);
$pathParts = pathinfo($Nomefile);
//if(isset($pathParts['extension']))
if (array_key_exists('extension', $pathParts))
{
    $ext = strtoupper($pathParts['extension']);

    AJXP_Logger::debug("estensione: ".$ext);

    $pos = strpos($_SERVER["REQUEST_URI"] , "public");

    if ($pos !== false) {
        if ( $ext == 'JPG' || $ext == 'BMP' || $ext == 'PNG' || $ext == 'JPEG')
        {
            $this->readFile($this->urlBase.$selection->getUniqueFile(), "image", $localName);
        }
        else
        {
            $this->readFile($this->urlBase.$selection->getUniqueFile(), "force-download", $localName);
        }
    }
 else
    {
        $this->readFile($this->urlBase.$selection->getUniqueFile(), "force-download", $localName);
    }
} else { $this->readFile($this->urlBase.$selection->getUniqueFile(), "force-download", $localName); }

With a bit of code I check if the current request it’s done from a public url, and in this case I force the visualization of the image instead of simple download it.
I have to check Request_URI for “public” because otherwise when you press the “download” button inside ajaxplorer the browser opens the image instead of download it.

 

If you need to enable debug mode, you can modify conf/bootstrap_context.php with:

define("AJXP_SERVER_DEBUG"  , true);

Il mio cloud con AjaXplorer, SFTP e IIS

Una combinazione davvero strana quella che ho creato stavolta!

Volevo essere indipendente dai vari Dropbox, Google Drive, Skydrive e simili.. vuoi per le politiche di privacy un po contestabili, vuoi per i dati a volte passati in chiaro durante il trasferimento, vuoi che preferivo avere “tutto in casa”.

Il mio obbiettivo principale era avere la possibilità di sincronizzare foto, documenti e backup del mio smartphone android con il mio server, senza essere vincolato a passare per servizi esterni, ed avere un’interfaccia web che mi permettesse di gestire tutti i miei file in modo comodo e funzionale.