wslover317 Posted September 7, 2011 Share Posted September 7, 2011 I am using a Wordpress plugin that resizes based on input in the admin. What I want to do, is automatically link to the original image, not the resized image. I figured out how to make it keep the original, but I can automatically link to it. I can link to the resized images however. // if the image is larger than the width/height requirements, then scale it down. if($width > $aio_slideshow_settings['img_width'] || $height > $aio_slideshow_settings['img_height']) { // resize the image $resized = image_resize($file, $aio_slideshow_settings['img_width'], $aio_slideshow_settings['img_height'], true, 'resized'); $resized_url = $upload_dir_url . basename($resized); // delete the original $file = $file; $url = $resized_url; } // make the thumbnail $thumb_height = round((100 * $aio_slideshow_settings['img_height']) / $aio_slideshow_settings['img_width']); if(isset($upload['file'])) { $thumbnail = image_resize($file, 100, $thumb_height, true, 'thumb'); $thumbnail_url = $upload_dir_url . basename($thumbnail); } // use the timestamp as the array key and id $time = date('YmdHis'); // add the image data to the array $aio_slideshow_images[$time] = array( 'id' => $time, 'file' => $file, 'file_url' => $url, 'thumbnail' => $thumbnail, 'thumbnail_url' => $thumbnail_url, 'image_links_to' => $resized_url ); // add the image information to the database $aio_slideshow_images['update'] = 'Added'; update_option('aio_slideshow_images', $aio_slideshow_images); } /* /////////////////////////////////////////////// this final section generates all the code that is displayed on the front-end \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ */ function aio_slideshow($args = array(), $content = null) { global $aio_slideshow_settings, $aio_slideshow_images, $value; // possible future use $args = wp_parse_args($args, $aio_slideshow_settings); $newline = "\n"; // line break echo '<div id="'.$aio_slideshow_settings['div'].'">'.$newline; echo '<ul>'.$newline; foreach((array)$aio_slideshow_images as $image => $data) { echo '<li>'; echo '<a href="'.$data['file_url'].'">'; echo '<img src="'.$data['file_url'].'" width="'.$aio_slideshow_settings['img_width'].'" height="'.$aio_slideshow_settings['img_height'].'" class="'.$data['id'].'" alt="" />'; if(($aio_slideshow_settings['text_position'] !== "dont_display") && ($data['title']) ) { echo '<div class="text-bg">'; echo '<h2>'; echo $data['title']; echo '</h2>'; echo '</div>'; } echo '</a>'; echo '</li>'; echo $newline; } echo '</ul>'.$newline; echo '<div id="prevnext"><a id="prev" href="#prevslide">Prev</a> <a id="next" href="#nextslide">Next</a></div>'; echo '</div>'.$newline; } I have skipped through to the parts where its resized, thumb, resized image and original are saved... Then to where it calls it in. Thank you in advance! Bill Quote Link to comment Share on other sites More sharing options...
wslover317 Posted September 7, 2011 Author Share Posted September 7, 2011 Sorry, clarification. I can't link to the original image, that is what I am trying to achieve... Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.