Support » Themes and Templates » randome fonction with crop fonction for displaying some pictures

  • Hello

    I ‘m new wordpress 2.51 user I would like to know if it’s possible with your plug in to display pictures on page with this idea:

    [title picture](picture url) :

    // 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);

    I would like to make something like this :

    but I ‘m searching how to make something like that because I would like to use this system with possibility to see post, page or other when you click on picture. Maybe I must use wp request in database for to see wp post?

    But I see an idea interesting I think : [code]`crop.php :
    $h=isset($_GET[‘h’])?$_GET[‘h’]:$w; // h est facultatif, =w par défaut
    $x=isset($_GET[‘x’])?$_GET[‘x’]:0; // x est facultatif, 0 par défaut
    $y=isset($_GET[‘y’])?$_GET[‘y’]:0; // y est facultatif, 0 par défaut
    header(‘Content-type: image/jpg’);
    header(‘Content-Disposition: attachment; filename=’.$src);
    $image = imagecreatefromjpeg($filename);
    $crop = imagecreatetruecolor($w,$h);
    imagecopy ( $crop, $image, 0, 0, $x, $y, $w, $h );
    ? `[/code]
    maybe some one send me suggestion or good idea.

  • The topic ‘randome fonction with crop fonction for displaying some pictures’ is closed to new replies.