Jump to content

Help Please


wslover317

Recommended Posts

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

Link to comment
https://forums.phpfreaks.com/topic/246599-help-please/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.