filename parsing....stuck!

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
I'm a newbie to PHP.

What I am trying to do is take a filename from a URL
( and dynamically re-size it based on
the "-t"

For example,  I have an original image that is called  "image.jpg"

If someone changes the URL to point to:  "image-t.jpg"  I want to parse
the "-t", resize it to a thumbnail and display that.

I have the resizing down so no problem there.  I just can't wrap my
head around regular expressions.


Re: filename parsing....stuck!

cbmeeks wrote:
Quoted text here. Click to load it

Take a look at substr and strpos. That should do it. If you dont know
them, then look at


Re: filename parsing....stuck!


In this code:

    $fn = 'demo-640x480.jpg';

    $pattern = '/\d+/';

    $matches = preg_split($pattern, $fn, -1, PREG_SPLIT_NO_EMPTY);


give me:

Array ( [0] => demo- [1] => x [2] => .jpg )

why do I not get  640 480??

Re: filename parsing....stuck!


I'm an idiot.

It's    D  not d

cbmeeks wrote:
Quoted text here. Click to load it

Site Timeline