Well, the first problem sL ԖA Post To WebpageAVB100AVB100@Hotmail.com140.211.121.227e have two values and the code isn't likely to be used again on the same page, it is easiest to just program this inline.
This option will be added in the next version.
The following code (which will be implemented in some form in the next version) should be placed somewhere in front of the code that actually outputs the image...
$imagesize = getimagesize($saved_album_art_url);
if ( $imagesize )
{
$maxsize = 300;
if ($imagesize[0] > $maxsize) {$imagesize[0] = $maxsize;}
if ($imagesize[1] > $maxsize) {$imagesize[1] = $maxsize;}
}
Then, the image can be displayed with the following...
<IMG SRC="'.$saved_album_art_url.'" WIDTH="'.$imagesize[0].'" HEIGHT="'.$imagesize[1].'" ALT="'.$saved_album_name.'">
To patch your code, I would do the following:
<? function imageResize($saved_album_art_url,$dimension) {
$albumimage = getimagesize($saved_album_art_url);
$width = $albumimage[0];
$height = $albumimage[1];
if ( $albumimage && ($width>300 || $height>300) ) {
$width = "300";
$height = "300";
}
if ($dimension=='width') {
return $width;
}
if ($dimension=='height') {
return $height;
}
} ?>
and
<? if ( isset($saved_album_art_url) ){
echo '<A HREF="'.$saved_amazon_url.'" target="_new">
<IMG border="0" width="'.imageResize($saved_album_art_url,'width').'" height="'.imageResize($saved_album_art_url,'height').'"SRC="'.$saved_album_art_url.'" ALT="'.$saved_album_name.'">
</A><br><br>';
} ?>
I find it slightly more cumbersome to use a function in this case...
Some notes on your PHP...
The parameters of a function is for data being passed to a function
function myFunctionName($parameter, $parameter2)
{
$parameter; // 'Anything'
$parameter2; // 'Something else'
}
myFunctionName('Anything','Something else');
Variables defined within a function have a limited scope (they are only available within the function itself) If you try to access those variables from outside the function, they will not be found
Once the script has been told to process as php, using the '<?' or '<?php' tag, it is not necessary to do it again unless it has been closed '?>'
If you're using a limited php segment to output a variable, you need to use an echo, or another print command e.g. <? echo $var; ?>
Anyways, hope this helps. Happy coding.