Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Page 1 of 2 12 LastLast
Results 1 to 15 of 20
  1. #1
    Senior Coder
    Join Date
    Jun 2008
    Location
    Cornwall
    Posts
    2,097
    Thanks
    297
    Thanked 12 Times in 12 Posts

    Exclamation is it possible to reduce the file size of an image without manually doing it?

    Hi,

    ok i have a website with many images on it, these images are pulled from xml files and i have no control over the size of them, meaning my pages load slowley

    so what i was thinking of doing is:
    1. download each individual image
    2. somehow reduce the image quality? therefor its size without doing each one manually
    3. upload the new images to use on my site


    does this sound possible?
    thanks

  • #2
    Master Coder
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,493
    Thanks
    8
    Thanked 1,089 Times in 1,080 Posts
    Are they pulled from XML with a PHP script?

    Maybe PHP GD to put them into a cache ...
    How often do they change, or are added/deleted?

    Using GD on-the-fly for every page load would be
    extensive, but processing them periodically into a
    "cache" directory would make things fast.

  • #3
    Senior Coder
    Join Date
    Jun 2008
    Location
    Cornwall
    Posts
    2,097
    Thanks
    297
    Thanked 12 Times in 12 Posts
    hi mate,

    i use amazon rss feeds such as this one to pullout the top 3 items/images and these are stored in my db.

    i have a script which updates my db once a day, it deletes all records and inserts the new set.

    thanks
    Luke

  • #4
    Regular Coder
    Join Date
    Nov 2007
    Posts
    110
    Thanks
    0
    Thanked 1 Time in 1 Post
    Quote Originally Posted by LJackson View Post
    hi mate,

    i use amazon rss feeds such as this one to pullout the top 3 items/images and these are stored in my db.

    i have a script which updates my db once a day, it deletes all records and inserts the new set.

    thanks
    Luke
    Your image files are storing in DB or only the path?

  • #5
    Senior Coder
    Join Date
    Jun 2008
    Location
    Cornwall
    Posts
    2,097
    Thanks
    297
    Thanked 12 Times in 12 Posts
    hi shakir,

    its only the img path thats stored im my db.

    thanks

  • #6
    Master Coder
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,493
    Thanks
    8
    Thanked 1,089 Times in 1,080 Posts
    So you already have the PHP script that parses the <img> and text?

    What does that script look like?
    It's within that script where you'll use PHP GD to resize the image.

  • #7
    Senior Coder
    Join Date
    Jun 2008
    Location
    Cornwall
    Posts
    2,097
    Thanks
    297
    Thanked 12 Times in 12 Posts
    the script which gets the image and title looks like this

    PHP Code:
        //Entertainment Update
        
        
    $today date("d-M-Y, h:i a");
        
            
    $feeds = array(
    "http://www.amazon.co.uk/rss/bestsellers/dvd/ref=pd_nr_rss_link",                                                "http://www.amazon.co.uk/rss/new-releases/dvd/ref=pd_nr_rss_link","http://www.amazon.co.uk/rss/most-gifted/dvd/ref=pd_mg_rss_link""http://www.amazon.co.uk/rss/bestsellers/music/ref=pd_ts_rss_link""http://www.amazon.co.uk/rss/new-releases/music/ref=pd_nr_rss_link""http://www.amazon.co.uk/rss/most-gifted/music/ref=pd_mg_rss_link""http://www.amazon.co.uk/rss/bestsellers/videogames/ref=pd_ts_rss_link""http://www.amazon.co.uk/rss/new-releases/videogames/ref=pd_nr_rss_link""http://www.amazon.co.uk/rss/most-gifted/videogames/ref=pd_mg_rss_link",
    "http://www.amazon.co.uk/rss/bestsellers/dvd/383380011/ref=pd_ts_rss_link",
    "http://www.amazon.co.uk/rss/new-releases/dvd/383380011/ref=pd_nr_rss_link",
    "http://www.amazon.co.uk/rss/most-gifted/dvd/383380011/ref=pd_mg_rss_link",
    "http://www.amazon.co.uk/rss/bestsellers/books/ref=pd_ts_rss_link",
    "http://www.amazon.co.uk/rss/new-releases/books/ref=pd_nr_rss_link",
    "http://www.amazon.co.uk/rss/most-gifted/books/ref=pd_mw_rss_link"
        
    );


        
        
    $today date("d-M-Y, h:i a");
        
        
    $itemno 1;
        
    $itemtype 0;
        
    $product_Number 1;
        
        foreach (
    $feeds as $feed)
        {
        
    $count 1;

          
    $feedreader simplexml_load_file("$feed");
        
    $p_cnt count($feedreader->channel->item);    
        
    //print "<p>$p_cnt</p>";
        
        
        
    if ($p_cnt 3)
        {
            
    $items 3;
            
    $empty = ($items);
        }
        else
        {
            
    $items = ($p_cnt);
            
    $empty = ($p_cnt);
        }
        print 
    "<p>$empty</p>";
        
        foreach (
    $feedreader->channel->item as $item)
        {

        
    $title addslashes ($item->title);
        
    $title preg_replace('/#\d+:\s/'""$title);
        
    $photosource get_string_between($item->description'<img src="','"');
        
    $otherinfo get_string_between($item->description'<span class="riRssContributor">','</span>');
        } 
    there is more to this script but the rest isnt relivant (i dont think)

    cheers
    Luke

  • #8
    Master Coder
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,493
    Thanks
    8
    Thanked 1,089 Times in 1,080 Posts
    I'm sort of confused because when I look at those feeds
    and view the images, they are all sort of small images ...

    Example of 2 images from the feeds ...

    http://ecx.images-amazon.com/images/...160_SS150_.jpg
    http://ecx.images-amazon.com/images/...160_SS150_.jpg

    So you mentioned that they load slow (meaning they are large images)?
    Are the examples I showed what the images are?

  • #9
    Senior Coder
    Join Date
    Jun 2008
    Location
    Cornwall
    Posts
    2,097
    Thanks
    297
    Thanked 12 Times in 12 Posts
    yes mate those i believe are the ones, my pages take approx 140sec at 56k (i think) which is slow, and the images are approx 8kb each which isnt much but when you have 45 of them it takes its toll, thats why i wanted some way to reduce the size/quality of the images.

    thanks
    Luke

  • #10
    Master Coder
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,493
    Thanks
    8
    Thanked 1,089 Times in 1,080 Posts
    Luke ...

    I've heard that in the U.S., only 10% of users still use dial-up.
    Mostly rural users that have no DSL or Cable access.

    I'm not sure where you live, but I would say that this is a non-issue in your case.

    Because those images will be constantly changing, using GD to process them into
    75% quality (reduced quality) will actually take more processing time than loading
    the 8K images. That's where my thoughts were with post #8.

    If the images were really huge, using PHP GD would be the most efficient method.
    In your case, I think PHP GD would make things even slower.

    Give me a link to your site and I'll do some timing tests with DSL and Broadband.
    Maybe other viewers have a better perspective on this.

  • #11
    Senior Coder
    Join Date
    Jun 2008
    Location
    Cornwall
    Posts
    2,097
    Thanks
    297
    Thanked 12 Times in 12 Posts
    i live in the UK, where things are a bit slower getting to us i am lucky enough to have Broadband but some dont.

    you mean will all the help youve given me in the past several months you dont know my url? shocking

    here it is mate

    cheers
    Luke

  • #12
    Master Coder
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,493
    Thanks
    8
    Thanked 1,089 Times in 1,080 Posts
    Sorry Luke,
    I see so many URL's, I didn't make the connection at first.

    Viewing your site on my DSL, which is faster than dial-up,
    but slower than cable broadband ... it loads almost instantly.

    I used to have dial-up for over 10 years ... and I realized then, and
    expected those pages to load slow. In your case, I really wouldn't
    spend the energy to make them smaller. It's just not worth it.

    Take that time to fix the top menu tabs and background color.
    See the attached image below.
    Attached Thumbnails Attached Thumbnails is it possible to reduce the file size of an image without manually doing it?-screenshot.jpg  

  • #13
    The Apostate Apostropartheid's Avatar
    Join Date
    Oct 2007
    Posts
    3,215
    Thanks
    16
    Thanked 265 Times in 263 Posts
    In the UK, broadband penetration should be even higher. Don't worry about it: people still on dialup will be used to that speed.

  • #14
    Senior Coder
    Join Date
    Jun 2008
    Location
    Cornwall
    Posts
    2,097
    Thanks
    297
    Thanked 12 Times in 12 Posts
    oh thats ok

    thanks for running those tests appreciate it
    just out of curiosity which browser was that using mlseim?

    thanks guys
    Luke

  • #15
    Master Coder
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,493
    Thanks
    8
    Thanked 1,089 Times in 1,080 Posts
    IE8.0

    But here's the other strange thing.
    On one PC I have, it does that on FF, but not on my other PC.
    strange.


  •  
    Page 1 of 2 12 LastLast

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •