M README.md +5 -4
@@ 1,6 1,6 @@
-# MeBo
+# piclog
-MeBo is a simple message board system.
+A place to upload and share your pictures.
## Requirements
@@ 10,5 10,6 @@ MeBo is a simple message board system.
## Installation
1. clone this repository to get the source
-2. make a copy of public/includes/config-sample.php in public/includes/config.php. Update the constants to match your environment
-3. push the public/ directory to your server
No newline at end of file
+2. rename `config-sample.php` to `config.php`. Update the constants to match your
+ environment
+3. transfer files to your server
No newline at end of file
M +13 -12
@@ 3,16 3,18 @@
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>plog</title>
<title>piclog</title>
<link rel="stylesheet" href="style.css">
<link type="application/atom+xml" rel="alternate" href="feed.php">
</head>
<body>
<header>
<header class="main-header">
<a href="index.php"><img src="logo.png"></a>
<nav>
<a href="index.php">home</a>
<?php if ($user): ?>
<a href="index.php">home</a>
<a href="upload.php">upload</a>
<a href="widget.php">widget</a>
<a href="profile.php?id=<?= $user['id'] ?>">profile</a>
<a href="settings.php">settings</a>
<a href="logout.php">logout</a>
@@ 25,13 27,12 @@
<?php endif; ?>
</nav>
</header>
<?php if (is_visitor($user)): ?>
<div class="is-visitor">
You account is pending activation. You will be notified by email when activated.
</div>
<?php endif ?>
<?php if ($flash = $App->getSession()->getFlash()): ?>
<main>
<?php if (is_visitor($user)): ?>
<div class="is-visitor">
You account is pending activation. You will be notified by email when activated.
</div>
<?php endif ?>
<?php if ($flash = $App->getSession()->getFlash()): ?>
<p class="flash"><?= $flash ?></p>
<?php endif; ?>
<main>
<?php endif; ?>
No newline at end of file
M index.php +3 -1
@@ 9,7 9,9 @@ require 'includes/app.php';
<?php include 'includes/header.php'; ?>
<h1>piclog</h1>
-<p>A little place to upload and share your pictures.</p>
+<p>Hi! Here you can share your JPEG pictures with your friends. You can customize the CSS of your profile, and even add
+ a little widget to your site! The pictures are heavily compressed to keep the file
+ size small.</p>
<p class="rss"><a href="feed.php">Subscribe via RSS</a></p>
<?php foreach ($images as $image): ?>
A => latest.php +17 -0
@@ 0,0 1,17 @@
+<?php
+include 'includes/app.php';
+
+$id = get_id();
+$images = $App->getImage()->getFromUser($id, 1);
+if (!count($images)) {
+ http_response_code(404);
+ exit;
+}
+$filename = file_path($id, $images['rows'][0]['filename']);
+
+header("Content-Type: image/jpeg");
+header("Content-Length: " . filesize($filename));
+
+$fp = fopen($filename, 'rb');
+
+fpassthru($fp);
M style.css +22 -2
@@ 1,7 1,27 @@
+* {
+ box-sizing: border-box;
+}
+
body {
+ font-family: monospace;
+ font-size: 16px;
+ background-color: midnightblue;
+}
+
+.main-header, main {
+ max-width: 45em;
+ margin: 0 auto;
background-color: aliceblue;
- font-family: monospace;
- max-width: 800px;
+ padding: 1em;
+}
+
+.main-header {
+ background-color: paleturquoise;
+}
+
+h1, h2 {
+ margin-top: 0;
+ color: midnightblue;
}
.title {
M upload.php +4 -8
@@ 25,9 25,8 @@ function resize_image_gd($orig_path, $ne
case 'image/jpeg':
$orig = imagecreatefromjpeg($orig_path);
break;
- case 'image/png':
- $orig = imagecreatefrompng($orig_path);
- break;
+ default:
+ exit;
}
$new = imagecreatetruecolor($new_width, $new_height);
@@ 38,9 37,6 @@ function resize_image_gd($orig_path, $ne
case 'image/jpeg':
$result = imagejpeg($new, $new_path, 5);
break;
- case 'image/png':
- $result = imagepng($new, $new_path, 9);
- break;
}
return $result;
@@ 49,7 45,7 @@ function resize_image_gd($orig_path, $ne
$message = '';
$resized = false;
$errors = [];
-$allowed_types = ['image/jpeg', 'image/png', 'image/gif'];
+$allowed_types = ['image/jpeg'];
$max_size = 524288; // 512 kb
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
@@ 96,7 92,7 @@ if ($_SERVER['REQUEST_METHOD'] == 'POST'
<form action="<?= $_SERVER['PHP_SELF'] ?>" method="post" enctype="multipart/form-data">
<?php include 'includes/csrf.php' ?>
<label for="name">Image:</label>
- <input type="file" id="image" name="image" accept="image/*">
+ <input type="file" id="image" name="image" accept="image/jpeg">
<label for="description">Description:</label>
<textarea name="description" id="description" class="form-control" required></textarea>
A => widget.php +12 -0
@@ 0,0 1,12 @@
+<?php
+require 'includes/app.php';
+?>
+
+<?php include 'includes/header.php'; ?>
+<h1>Widget</h1>
+<p>Add the following snippet to your site to show your latest picture. Feel free to customize how it looks like!</p>
+<textarea
+ style="width: 100%;"><a href="profile.php?id=<?= $user['id']; ?>"><img src="latest.php?id=<?= $user['id']; ?>"></a></textarea>
+<p><a href="profile.php?id=<?= $user['id']; ?>"><img src="latest.php?id=<?= $user['id']; ?>"></a></p>
+
+<?php include 'includes/footer.php'; ?>