Afficher un message
Vieux 17/09/2007, 00h17   #5
Confused but working on it
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: foreach and str_replace

On 2007-09-16 14:58:31 -0700, "Rik Wasmus" <luiheidsgoeroe@hotmail.com> said:
>
> This does NOT alter $file. $file is not taken as a reference and altered
> inside str_replace();
>
> $file = str_replace('thumbs/', '', $file);


Yeah, that was dumb.

>> thx..ron

>
> Why do your images live in a thumbs dir and you still want an '/images/'
> link?
>
> However, this may you:
>
> <?php
> foreach (glob("thumbs/*.jpg") as $file){
> $filename = basename($file);
> echo "<a href='images/$filename'><img src='$filename'
> class='pad1em'></a>";
> }
> ?>
>
>
> --
> Rik Wasmus


My thumbs live in thumbs and the full size in images. Made sense to me.
I export from iPhoto a set of thumbs and then the larger pics.

<?php
foreach (glob("thumbs/*.jpg") as $file){
$filename = basename($file);
echo "<a href='images/$filename'><img src='thumbs/$filename'
class='pad1em'></a>";
}
?>

Works great. I got those file markers and realized you took out the
"thumbs/" in the echo statement.

Uploaded and the files are in order of filename.

Next week maybe I'll learn how to take a directory named images and
create thumbs on the fly. Might hve been easier.

Thanks for all the .

Ron

  Réponse avec citation
 
Page generated in 0,05834 seconds with 9 queries