WordPress.org

Support

Support » Plugins and Hacks » [Resolved] Get the full image url parameter?

[Resolved] Get the full image url parameter?

Viewing 2 replies - 1 through 2 (of 2 total)
  • After fighting like crazy I finally managed to hack something together… I couldn’t touch the plugins files or the function file (and I´m not really good at PHP). BUt I managed to strip everything from the code that get_the_image gives you and leave the actual image URL.

    What I wanted to do here is to have a direct link to the image (instead of a link to the page where the image is). I’m sure there are better methods but this is mine.

    <?php
    $text =  get_the_image( array( 'custom_key' => array( 'thumbnail' ), 'echo' => false, 'link_to_post' => false,'size' => 'full') ); ;
    preg_match_all('/\b(([\w-]+:\/\/?|www[.])[^\s()<>]+(?:\([\w\d]+\)|([^[:punct:]\s]|\/)))/',$text,$matches);
    $matches = $matches[1];
    $list = array();
    
    foreach($matches as $var)
    {
       print("<a href='".$var."' rel='lightbox'>");
    }
    ?>
    	    <li class="post-<?php the_ID(); ?> thumb-big"><?php get_the_image( array( 'custom_key' => array( 'thumbnail' ),  'link_to_post' => false,'default_size' => '320x320',  'width' => '320', 'height' => '320' ) ); ?></li></a>

    Thanks for you reply miguelesquirol, I’ll try to choose what I want from your code and try it.
    Thanks again.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Resolved] Get the full image url parameter?’ is closed to new replies.