PHP Classes

How to Install the PHP RAR Extension to Use with the PHP Comic Reader Tools, not Just for Comics. - PHP Comic Reader Tools package blog

Recommend this page to a friend!
  All package blogs All package blogs   PHP Comic Reader Tools PHP Comic Reader Tools   Blog PHP Comic Reader Tools package blog   RSS 1.0 feed RSS 2.0 feed   Blog How to Install the PH...  
  Post a comment Post a comment   See comments See comments (0)   Trackbacks (0)  

Author:

Viewers: 381

Last month viewers: 8

Package: PHP Comic Reader Tools

The PHP Comic Reader Tools package is useful for viewing comics that are contained in compressed archives.

This package was developed to be used for more than just viewing comic files in CBR/CBZ formats. The PHP Comic Reader Tools package can also be used to read simple ZIP archives selected images in macOS Finder or the OS you use by renaming the file extension to cbz.

To make this package work, you need to install the PHP RAR extension. Read this article to learn how you can install that extension and use this package to read your favorite comics.




Loaded Article

In this article you will learn:

Introduction to the Possibilities of the PHP Comic Reader Tools

How to Install the PHP RAR Extension to Run the PHP Comic Reader Tools Package

How to Run the PHP Comic Tools Package using the PHP Built-in Web Server

How to Download the PHP Comic Tools Package or Install It with PHP Composer


Introduction to the Possibilities of the PHP Comic Reader Tools

As I was finishing up the code on this class, I was thinking of making an example cbz file for the project demo, and it donned on me.

This package can also be used to display archived photos as a slideshow or even display slides for a meeting that you want to share from your own private platform.

I developed this package in a way that the package code can be used for more than just viewing CBR/cbz comic files!!

The possibility of creating slide shows from photos is awesome. You can make ZIP archives of your old family photos and have a slide show for each ZIP archive that you make.  The simplistic nature of creating a ZIP archive of selected images in macOS Finder, renaming the file extension to cbz makes creating a gallery of albums super easy.

How to Install the PHP RAR Extension to Run the PHP Comic Reader Tools Package

To get started, you should grab the code from PHP classes and extract it into your home directory.

Copy your CBZ/CBR archives into the comic folder.

If you don't have the PECL RAR extension installed, then download a copy from https://pecl.php.net/package/rar and build it if you are using a Mac or Linux.

There is also have a DLL available for Windows (x86/x64) PHP 7.0 - 7.2.  Below follows the build instructions for macOS and Linux. I stuck with the system version of PHP.

$ cd <src dir>
$ ./configure
$ make
$ make test
$ make install

You can enable this PECL extention in the  your php.ini file.

extension=rar.so

I have a variable in my class that when set to TRUE, the class will embed the images as base64 encoded strings.

This is a good way to have your slide show in a single file, but it also makes PHP use a lot of memory with large image. You can overcome this problem by increasing the PHP memory limit setting in PHP by having a line like this in the php.ini file.

memory_limit = 2048M

How to Run the PHP Comic Tools Package using the PHP Built-in Web Server

I used the PHP built-in Web server for this project since this is just a personal reader for comics that you can setup on a Raspberry PI, pine64 or other SBCs.

Take a look at the index.php script and edit the $dir variable to set it to your comic book directory.  I have also wrote a setup.php script that creates an ini file of all the scanned comic book archives. 

$ cd <comic srv>
$ php setup.php
$ php -S localhost:8888 index.php

You can also run the server with another IP address or hostname, this can be run as a normal user.

$ php -S <ip address|hostname>:8888 index.php

The ini file that is generated with the setup.php script, has links to each image generated in a section for each archive and the data for retrieving the link is base64 encoded for the query string.

You can comment out the image links you want to hide from your slide show, you can re-order the image links to your liking in case the pages are out of order.

[./comic/gigs.cbz]

title="gigs"
file="./comic/gigs.cbz"
dir="./comic"
img[]="index.php?L2dpZ3MuY2J6fDIwMTUwNjA3XzAxMjExNDA5NF9pT1MuanBn"
img[]="index.php?L2dpZ3MuY2J6fElNR18wMjIzLmpwZw=="
img[]="index.php?L2dpZ3MuY2J6fElNR18wMzI4LkpQRw=="
show="1"
[./comic/screens.cbz]
title="screens"
file="./comic/screens.cbz"
dir="./comic"
img[]="index.php?L3NjcmVlbnMuY2J6fDIwMTUwNjAyXzAwMzg0NjUzOF9pT1MuanBn"
img[]="index.php?L3NjcmVlbnMuY2J6fElNR18wMDMzLmpwZw=="
img[]="index.php?L3NjcmVlbnMuY2J6fElNR18wMzc0LkpQRw=="
show="1"

How to Download the PHP Comic Tools Package or Install It with PHP Composer

The PHP Comic Tools package can be downloaded from download page or be installed using the PHP Composer tool following instructions in the Composer install instructions page.




You need to be a registered user or login to post a comment

1,614,673 PHP developers registered to the PHP Classes site.
Be One of Us!

Login Immediately with your account on:



Comments:

No comments were submitted yet.



  Post a comment Post a comment   See comments See comments (0)   Trackbacks (0)  
  All package blogs All package blogs   PHP Comic Reader Tools PHP Comic Reader Tools   Blog PHP Comic Reader Tools package blog   RSS 1.0 feed RSS 2.0 feed   Blog How to Install the PH...