Difference between revisions of "IMAGEBROWSER"

From rbachwiki
Jump to navigation Jump to search
 
(One intermediate revision by the same user not shown)
Line 30: Line 30:
FLUSH PRIVILEGES;
FLUSH PRIVILEGES;
</pre>
</pre>
5. Configure app on the server


<pre>
<pre>
cd /var/www/html
cp config/config.example.php config/config.php
nano config/config.php
</pre>


'''Set these values'''
<pre>
'base_url' => '',
'categories_dir' => __DIR__ . '/../categories',
'thumbnail_dir' => __DIR__ . '/../cache/thumbs',
'db' => [
    'host' => '127.0.0.1',
    'port' => 3306,
    'database' => 'imagebrowser',
    'username' => 'imagebrowser_user',
    'password' => 'your-strong-password',
    'charset' => 'utf8mb4',
],
</pre>
</pre>
'''Use base_url => '' if the app is at the domain root. If installed in a subfolder like /gallery, use:'''
'base_url' => '/gallery',
6. Set Permissions
'''Apache/PHP must be able to read categories/ and write to cache/ and uploads:'''


<pre>
<pre>
sudo chown -R www-data:www-data /var/www/html/cache /var/www/html/uploads /var/www/html/categories
sudo chmod -R 775 /var/www/html/cache /var/www/html/uploads /var/www/html/categories
</pre>
7. Apache Setup
'''Check which document root Apache is actually serving:'''


</pre>
sudo apachectl -S
 
8.  Setup Conf file
 
sudo nano /etc/apache2/sites-available/imagebrowser.conf


'''Example '''
<pre>
<pre>
<VirtualHost *:80>
    ServerName yourdomain.com
    DocumentRoot /var/www/imagebrowser


    <Directory /var/www/imagebrowser>
        AllowOverride All
        Require all granted
    </Directory>
    ErrorLog ${APACHE_LOG_DIR}/imagebrowser_error.log
    CustomLog ${APACHE_LOG_DIR}/imagebrowser_access.log combined
</VirtualHost>
</pre>
</pre>
8. Enable it


<pre>
<pre>
sudo a2ensite imagebrowser.conf
sudo a2enmod rewrite
sudo systemctl reload apache2
</pre>
9. Create an Admin User For the App


'''Cd into the App Folder'''
<pre>
cd /var/www/html
php cli/create_admin.php admin@example.com "your-admin-password"
</pre>
</pre>
10.  Add Images to the Category Folder
11. Sign in to the Admin


<pre>
<pre>
https://yourdomain.com/login.php
</pre>
12. Go ot Admin and click
Sync Library
Render Category Thumbnails
13. Quick verifications. Run these on the server


<pre>
cd /var/www/html
php -l index.php
php -l thumb.php
php -l app/bootstrap.php
php -l app/thumbnails.php
</pre>
</pre>


<pre>
<pre>


</pre>
</pre>

Latest revision as of 16:46, 29 May 2026

Server Setup

1. upload contents to web folder

Even if PHP is already installed, confirm MySQL and GD support:

sudo apt update
sudo apt install php-mysql php-gd exiftool
php -v
php -m | grep -E 'pdo_mysql|gd'

Create Database

In phpMyAdmin:

Create a database, for example imagebrowser.

Use collation utf8mb4_unicode_ci.

Import:

database/schema.sql

4. Create MySQL User

You can do this in phpMyAdmin, or with MySQL CLI:

CREATE USER 'imagebrowser_user'@'localhost' IDENTIFIED BY 'your-strong-password';
GRANT ALL PRIVILEGES ON imagebrowser.* TO 'imagebrowser_user'@'localhost';
FLUSH PRIVILEGES;

5. Configure app on the server

cd /var/www/html
cp config/config.example.php config/config.php
nano config/config.php

Set these values

'base_url' => '',
'categories_dir' => __DIR__ . '/../categories',
'thumbnail_dir' => __DIR__ . '/../cache/thumbs',
'db' => [
    'host' => '127.0.0.1',
    'port' => 3306,
    'database' => 'imagebrowser',
    'username' => 'imagebrowser_user',
    'password' => 'your-strong-password',
    'charset' => 'utf8mb4',
],

Use base_url => if the app is at the domain root. If installed in a subfolder like /gallery, use:

'base_url' => '/gallery',

6. Set Permissions

Apache/PHP must be able to read categories/ and write to cache/ and uploads:


sudo chown -R www-data:www-data /var/www/html/cache /var/www/html/uploads /var/www/html/categories
sudo chmod -R 775 /var/www/html/cache /var/www/html/uploads /var/www/html/categories

7. Apache Setup

Check which document root Apache is actually serving:

sudo apachectl -S

8. Setup Conf file

sudo nano /etc/apache2/sites-available/imagebrowser.conf

Example

<VirtualHost *:80>
    ServerName yourdomain.com
    DocumentRoot /var/www/imagebrowser

    <Directory /var/www/imagebrowser>
        AllowOverride All
        Require all granted
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/imagebrowser_error.log
    CustomLog ${APACHE_LOG_DIR}/imagebrowser_access.log combined
</VirtualHost>

8. Enable it

sudo a2ensite imagebrowser.conf
sudo a2enmod rewrite
sudo systemctl reload apache2

9. Create an Admin User For the App

Cd into the App Folder

cd /var/www/html
php cli/create_admin.php admin@example.com "your-admin-password"

10. Add Images to the Category Folder

11. Sign in to the Admin

https://yourdomain.com/login.php

12. Go ot Admin and click

Sync Library
Render Category Thumbnails

13. Quick verifications. Run these on the server

cd /var/www/html
php -l index.php
php -l thumb.php
php -l app/bootstrap.php
php -l app/thumbnails.php