WordPress.org

Ready to get started?Download WordPress

Forums

Get the Image
[resolved] Get the full image url parameter? (3 posts)

  1. Abdelhadi
    Member
    Posted 1 year ago #

    Hi.
    Thanks for this great plugin, I use it in all my themes now.
    I was looking for a parameter to get the full url image, but I didn't find it, so can you add it please in the next version?
    I mean I want a way to make the plugin retrive the full image url to use it in some situations, like in a slider for example.
    Thanks.

    http://wordpress.org/extend/plugins/get-the-image/

  2. miguelesquirol
    Member
    Posted 1 year ago #

    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>
  3. Abdelhadi
    Member
    Posted 1 year ago #

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

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.