So with the help of others, I accomplished finding jpegs and then i split the jpeg string, if it were chadian22.jpg, to load a chadian22_sm.jpg the sm= small, for the thumbnial, then there would be a link to the big one with the source of the link being the thumbnail. But i didnt want to make to filter through and resize it myself. so i developed the following code. Edit |||| Oh yah, I forgot, ignore some of my comments, some of them are just research i did on php.net but the funtion didnt end up getting used in the end , it was just there if I needed it for something, and for learning how its all put together. |||||
<?
$number = 0 ;// counter starting at 0
$nrow = 4 ;// amount of thumbnails per row
$dir = "." ;
if (is_dir($dir)){
if ($dh = opendir($dir)) {
while (($file = readdir($dh)) != false) {
if ( preg_match( '/\.jpg$/', $file) ){
if ((preg_match( '/\_sm.jpg$/', $file)) != true){
$jpegname = str_replace(".jpg", "", $file);
if ((is_file($jpegname."_sm.jpg"))== false){
// $size = getimagesize($jpeg)
//thanks to [url]http://www.onlinetools.org/articles/creating_thumbnails_all.php#The%20logic%20of%20batch%20processing%20thumbnails[/url] for resize dimensions code
$old_x=imageSX($file);
$old_y=imageSY($file);
if ($old_x > $old_y) {
$thumb_w=$new_w;
$thumb_h=$old_y*($new_h/$old_x);
}
if ($old_x < $old_y) {
$thumb_w=$old_x*($new_w/$old_y);
$thumb_h=$new_h;
}
if ($old_x == $old_y) {
$thumb_w=$new_w;
$thumb_h=$new_h;
}
$dst_img=ImageCreate($thumb_w,$thumb_h);
imagecopyresized($dst_img,$src_img,0,0,0,0,$thumb_w,$thumb_h,$old_x,$old_y);
imagejpeg($dst_img,$file."_sm.jpg");
}
echo "<a href=\"$bpic\"><img src=\"$file\"></A>" ;
if ($number == $nrow) { //if the max # of pics, then <BR>
echo "<br>";
$number = 0 ;
}
else {
$number++ ;
}
}
}
}
}
// $domain = stristr($email, 'e');
// $spic = "_sm" ;
// $bpic = str_replace($spic, "", "$file") ;
?>
I get the Error : Parse error: parse error, unexpected $ in C:\FoxServ\www\gallery\gather.php on line 65
-- I think there's more errors, but I really cant figure out what the error is so I can debug the rest of the thing. Line 65 is after the last ?> and its just blank space, how's this possible 😕 Thanks for all the help! THis is my first major code.