Better thumbnails on noimg and all functions working again

This commit is contained in:
alopexc0de 2013-02-15 17:29:23 -05:00
parent 0ebbf723cf
commit 530b609771

View File

@ -12,11 +12,9 @@
* *
* JavaScript fo show bigger image if clicked * JavaScript fo show bigger image if clicked
* Recently Uploaded Pictures on sidebar * Recently Uploaded Pictures on sidebar
* DONE - Thumbnails for image list on main page (100px x 100px) * Automatic thumbnail generation - genthumb() (100px x 100px)
* Fix headstuff() and title() * Fix headstuff() and title()
* DONE = Picture Thumbnail for uname, tag, and search
* Multiple tags without search? * Multiple tags without search?
* DONE - Convert to mysqli
* Classes? * Classes?
* *
* ----------------------------------------------------------- * -----------------------------------------------------------
@ -32,6 +30,7 @@
$comment = ''; $comment = '';
$username = ''; $username = '';
$tags = ''; $tags = '';
$_SESSION['noimg'] = '';
// GET functions // GET functions
@ -234,6 +233,8 @@
//$result=mysql_query($sql); //$result=mysql_query($sql);
//if($result){ //if($result){
move_uploaded_file($_FILES["file"]["tmp_name"], "Pictures/" . $name); move_uploaded_file($_FILES["file"]["tmp_name"], "Pictures/" . $name);
$donefile = 'Pictures/'.$name;
genthumb($donefile);
echo "Stored at: <a href='?img=$name'>". $name."</a>"; echo "Stored at: <a href='?img=$name'>". $name."</a>";
//}else{ //}else{
// echo "There was a problem uploading this file."; // echo "There was a problem uploading this file.";
@ -243,7 +244,6 @@
}else{ }else{
echo "There was a problem trying to upload your file - Could be a database error"; echo "There was a problem trying to upload your file - Could be a database error";
} }
$result->free();
} }
} }
} }
@ -255,6 +255,10 @@
// END OF GET FUNCTIONS // END OF GET FUNCTIONS
function genthumb($input){
echo "Placeholder for automatic 100x100px thumbnail generation of new pictures<br />\n";
}
function sanitize($input){ function sanitize($input){
if ($input == null) die("Sanatize() - No Input Provided, Aborting\r\n<br>"); if ($input == null) die("Sanatize() - No Input Provided, Aborting\r\n<br>");
include('dbsettings.php'); include('dbsettings.php');
@ -370,7 +374,8 @@
if($handle = opendir('Pictures')){ if($handle = opendir('Pictures')){
while(false != ($file = readdir($handle))){ while(false != ($file = readdir($handle))){
if($file != "." && $file != ".." && $file != ".htaccess"){ if($file != "." && $file != ".." && $file != ".htaccess"){
$thelist .= '<a href="?img='.$file.'"><img src="thumbs/'.$file.'" alt="Thumbnail for '.$file.'" /><br /> └ '.$file.'</a></font><br /><p></p>'."\n"; //$thelist .= '<a href="?img='.$file.'"><img src="thumbs/'.$file.'" alt="Thumbnail for '.$file.'" /><br /> └ '.$file.'</a></font><br /><p></p>'."\n";
$thelist .= "-".$file;
} }
} }
closedir($handle); closedir($handle);
@ -383,18 +388,17 @@
</code> </code>
</p> </p>
<center> <center>
<table> <h4>Uploaded Pictures:</h4>
<tr> ";
<td> $thelist = explode("-", $thelist);
<center>List of Uploaded Pictures:</center> foreach($thelist as $pics){
</td> if($pics == '' || $pics == null){
</tr> echo '';
<tr> }else{
<td> echo '<a href="?img='.$pics.'"><img src="thumbs/'.$pics.'" alt="'.$pics.'" title="'.$pics.'"/></a>'."\n ";
<center>$thelist</center> }
</td> }
</tr> echo"
</table>
</center> </center>
"; ";
} }
@ -425,7 +429,6 @@
* Fix headstuff() and title() * Fix headstuff() and title()
* DONE - Picture Thumbnail for uname, tag, and search * DONE - Picture Thumbnail for uname, tag, and search
* Multiple tags without search? * Multiple tags without search?
* DONE - Convert to mysqli
* Classes? * Classes?
* *
* ----------------------------------------------------------- * -----------------------------------------------------------
@ -537,6 +540,18 @@
</div> </div>
</li> </li>
</ul> </ul>
<!-- This is what I want the end result of the recently uploaded pictures to look like
<br />
<ul>
<li class="widget widget_text">
<div class="textwidget">
<h3>Recently Uploaded Pictures</h3><br />
<a href="?img=3gyvry5.gif"><img src="thumbs/3gyvry5.gif" alt="3gyvry5.gif" title="3gyvry5.gif"/></a>
<a href="?img=icbqp9.jpg"><img src="thumbs/icbqp9.jpg" alt="icbqp9.jpg" title="icbqp9.jpg"/></a>
</div>
</li>
</ul>
---------- Make what's commented below resemble (in output) what happens above
<br /> <br />
<ul> <ul>
<li class="widget widget_text"> <li class="widget widget_text">
@ -551,7 +566,7 @@
$name = $row['name']; $name = $row['name'];
$name = explode("-", $name); $name = explode("-", $name);
foreach($name as $names){ foreach($name as $names){
echo '<a href="?img='.$names.'">'.$names.'</a> '; echo '<a href="?img='.$names.'"><img src="thumbs/'.$names.'"></a>';
} }
}else{ }else{
echo "Error getting images from database"; echo "Error getting images from database";