Results 1 to 5 of 5

Thread: remove the final comma on image array

  1. #1
    Thread Starter
    Member damien's Avatar
    Join Date
    May 2009
    Location
    Melbourne, Australia
    Posts
    91
    Thanks
    0
    Thanked 0 Times in 0 Posts

    remove the final comma on image array

    Is this possible with the upload form?

    say I have image1,image2,image3,
    I'd rather have image1,image2,image3 //the last comma is removed.

    In the upload form process you have something like
    Code:
    $images .= $image . ",";
    but Is it possible to use something to strip the last comma from the end of the array?
    Code:
    $images = rtrim($image, ",");
    or
    rtrim($str,’,')
    somehow?

    Thanks for any advice

  2. #2
    Thread Starter
    Member damien's Avatar
    Join Date
    May 2009
    Location
    Melbourne, Australia
    Posts
    91
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: remove the final comma on image array

    I dont think I can strip the comma out in the theme php, so I'm guessing it's form process php that will solve this.

    I'd like it to upload image or images, and when images are submitted in the form the last trailing comma is detected and stripped. As yet, I cant get the function working, it usually strips the first comma it detects out so no other images are uploaded if there is more them one submitted.

  3. #3
    Thread Starter
    Member damien's Avatar
    Join Date
    May 2009
    Location
    Melbourne, Australia
    Posts
    91
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: remove the final comma on image array

    solved in my theme's single.php

    Code:
    $images = explode(",", $images,-1);

  4. #4
    groan's Avatar
    Join Date
    Nov 2009
    Location
    Ottawa, Canada
    Posts
    241
    Thanks
    0
    Thanked 3 Times in 2 Posts

    Re: remove the final comma on image array

    Thanks for posting your progress and solution!

  5. #5
    pepsi's Avatar
    Join Date
    Mar 2009
    Location
    New Zealand
    Posts
    14,883
    Thanks
    91
    Thanked 804 Times in 718 Posts

    Re: remove the final comma on image array

    Yes, thanks for sharing

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Displaying a Main Image or Large Image for listings
    By kwave12 in forum ClassiPress General Discussion
    Replies: 20
    Last Post: December 10th, 2010, 04:47 PM
  2. Remove some fields
    By knsin0 in forum ClassiPress General Discussion
    Replies: 1
    Last Post: June 26th, 2009, 02:52 PM