Afficher des images en utilisant du php?

Fermé
Mortimer59 Messages postés 139 Date d'inscription vendredi 27 juillet 2007 Statut Membre Dernière intervention 31 août 2018 - 16 juin 2008 à 16:24
 zz10 - 16 juin 2008 à 23:24
Bonjour,


Voilà n'étant pas adepte du php sur la base de ceci :

[le_titre_de_l'image](l'adresse_url_de_l'image) :

// do a querty with all the id's with local image tags ![image_name](image_url) -- random results
$query = "SELECT id FROM wp_posts WHERE post_status='publish' AND post_content REGEXP '![\[][^\]\)]([^\)])' ORDER BY RAND()";
$content_query = "SELECT post_content FROM wp_posts WHERE";

// these are regular expressions for extracting urls from above results
$full_pattern = "/!\[.*?\]\(.*?\)/s";
$url_pattern = "/\]\(.*?\)/s";
$title_pattern = "/!\[.*?\]/s";
$url_start = 2;
$title_start = 2;
// a function that grabs all the above data and puts it into an array named $urls
$urls = getImages('blog', $how_many, $query, $content_query, $full_pattern, $url_pattern, $url_start, $title_pattern, $title_start);


et de cela :

<?php
/*
By Matt Mullenweg modified by Olivier Baudry> http://olivierbaudrydesign.free.fr
Inspired by Dan Benjamin > http://hiveware.com/imagerotator.php
Latest version always at:
https://ma.tt/scripts/randomimage/
*/// Make this the relative path to the images, like "../img" or "random/images/".
// If the images are in the same directory, leave it blank.
$folder = '';

// Space seperated list of extensions, you probably won't have to change this.
$exts = 'jpg jpeg png gif';

$files = array(); $i = -1; // Initialize some variables
if ('' == $folder) $folder = './';

$handle = opendir($folder);
$exts = explode(' ', $exts);
while (false !== ($file = readdir($handle))) {
foreach($exts as $ext) { // for each extension check the extension
if (preg_match('/\.'.$ext.'$/i', $file, $test)) { // faster than ereg, case insensitive
$files[] = $file; // it’s good
++$i;
}
}
}
closedir($handle); // We’re not using it anymore
mt_srand((double)microtime()*1000000); // seed for PHP < 4.2
$rand = mt_rand(0, $i); // $i was incremented as we went along

header('Location: '.$folder.$files[$rand]); // Voila!
?>

j'aimerais créer modifier ceci pour afficher des images provenant de pages ou de rubriques de mon choix sous la forme de damier mais je sais pas comment faire.
A voir également:

1 réponse

Absolument rien compris...
0