Tagged: images Toggle Comment Threads | Keyboard Shortcuts

  • Peter Mahoney 6:48 pm on March 31, 2013
    Tags: filesize, images   

    You would not believe how important it is to optimise your images. I just saved 77.5% of one site’s total image filesize, without blinking.

    Permalink | Reply
     
  • Peter Mahoney 11:19 am on March 11, 2013
    Tags: images, jpgs, load, optimise, page size, page speed, ,   

    I just saved 10% off the total page size of my personal homepage at http://petermahoney.net – guess how?

    I just optimised the background image a bit. That’s all. Honestly, it pays to check these things once in a while!

    Permalink | Reply
     
  • Peter Mahoney 12:23 pm on March 1, 2013
    Tags: directory, display, folder, glob(), images,   

    Show all images in a directory using PHP 

    This is a sweet script. It displays all the files in a particular directory. In this case it’s a folder full of user uploads, so it makes keeping an eye on things a breeze.

    <?php
     foreach(glob('upl/*.*') as $file){
         echo '<img src="'.$file.'" border="0" alt="'.$file.'">';
     }
     ?>

    You can of course easily modify it to show only JPGs or other image types (if you’re pulling content from a directory of mixed file types) or to edit the echo so it returns images that link to user profiles etc.

    But this is it’s most basic form.

    Permalink | Reply
     
c
compose new post
j
next post/next comment
k
previous post/previous comment
r
reply
e
edit
o
show/hide comments
t
go to top
l
go to login
h
show/hide help
shift + esc
cancel