mirror of
https://github.com/sorenpeter/timeline.git
synced 2025-12-13 01:47:01 +00:00
Image upload works now
This commit is contained in:
parent
d77d088687
commit
a02edfd7c5
3 changed files with 45 additions and 11 deletions
|
|
@ -359,12 +359,40 @@ article small a:hover {
|
|||
min-width: 33%;
|
||||
}
|
||||
|
||||
nav.pagination {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
padding: 0.5rem 0;
|
||||
#new_twt a.upload-link {
|
||||
float: right;
|
||||
margin-top: -0.1rem;
|
||||
margin-right: 0.5rem;
|
||||
text-decoration: none;
|
||||
color: var(--text-light);
|
||||
}
|
||||
|
||||
#new_twt a.upload-link:hover,
|
||||
#new_twt a.upload-link:hover span {
|
||||
color: var(--accent);
|
||||
}
|
||||
|
||||
/* === Upload Image Form === */
|
||||
|
||||
.upload-grid {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 10rem;
|
||||
grid-gap: 1rem;
|
||||
margin: 0.5rem 0;
|
||||
padding: 0.5rem;
|
||||
}
|
||||
|
||||
.upload-grid img {
|
||||
max-height: 200px;
|
||||
width: 100%;
|
||||
object-fit: cover;
|
||||
object-position: 0 0;
|
||||
}
|
||||
|
||||
.upload-grid code {
|
||||
}
|
||||
|
||||
|
||||
/* === REFRESH === */
|
||||
|
||||
#refreshInfo {
|
||||
|
|
|
|||
|
|
@ -105,9 +105,10 @@ if (isset($_POST['submit'])) {
|
|||
|
||||
<article id="new_twt">
|
||||
<form method="POST">
|
||||
<div id="posting">
|
||||
<small class="right" style="margin-top: 0.25rem ;"><a href="./upload" target="_blank">Upload images</a></small>
|
||||
<div id="toolbar"></div>
|
||||
<div id="posting">
|
||||
<div id="toolbar">
|
||||
<a href="./upload" target="_blank" class="upload-link" title="Upload images"><i class="fa fa-upload" aria-hidden="true"></i></a>
|
||||
</div>
|
||||
<textarea class="textinput" id="new_post" name="new_post"
|
||||
rows="4" cols="100" autofocus required onfocus="var val=this.value; this.value=''; this.value= val;"
|
||||
placeholder="Your twt"><?= $textareaValue ?></textarea>
|
||||
|
|
|
|||
|
|
@ -131,23 +131,28 @@ $imgs_on_server = glob($media_upload."*.{jpg,jpeg,png,gif}", GLOB_BRACE);
|
|||
// Sort image files by date (based on: https://stackoverflow.com/questions/124958/glob-sort-array-of-files-by-last-modified-datetime-stamp
|
||||
usort($imgs_on_server, fn($a, $b) => -(filemtime($a) - filemtime($b)));
|
||||
|
||||
echo '<table class="center">';
|
||||
echo '<center><em>Copy the code for images and paste it into the new message box</em></center>';
|
||||
|
||||
foreach ($imgs_on_server as $img) {
|
||||
|
||||
$public_file = $config["public_media"] . "/" . basename($img);
|
||||
|
||||
/*
|
||||
echo '<tr class="preview">';
|
||||
echo '<td><a href="'.$public_file.'">';
|
||||
echo '<img src="'.$public_file.'" style="width=50px;">';
|
||||
echo '<img src="'.$public_file.'" style="width:300px; max-height:200px; object-fit: cover;">';
|
||||
echo '</a></td>';
|
||||
|
||||
//$img = str_replace('../', $base_url, $img);
|
||||
echo '<td><code></code></td>';
|
||||
echo '</tr>';
|
||||
*/
|
||||
echo '<section class="upload-grid">';
|
||||
echo '<code></code>';
|
||||
echo '<a href="'.$public_file.'"><img src="'.$public_file.'"></a>';
|
||||
echo '</section>';
|
||||
}
|
||||
|
||||
echo '</table>';
|
||||
//echo '</table>';
|
||||
|
||||
?>
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue