Im trying to rezise some images that are imported from a folder. It doesent matter if it only show the realpicture as a thumbnail since the size of the file wont be much larger than 500kb,
Is there a way I can make the images as clickable images ? I have google it , but cant seem to find a solution that helps me.
This is the code that reads from the folder
$files = glob("uploads/*.*");
for ($i=1; $i<count($files); $i++)
{
$num = $files[$i];
echo '<img src="'.$num.'" alt="random image">'." ";
}
I’m not sure how to actually resize the images with PHP to reduce the file size, but to make the browser render them at a small ‘thumbnail’ size just add a CSS class attribute to the images that are pushed out. Something like this:
Then, just add some CSS for the img.thumb class to the top of your document, or wherever you have the rest of your CSS:
If you want the images to by clickable (presumably linking to the full-size image), just wrap anchor tags around your img tags when echo’ing to the document. Something like this: