Forum Moderators: open
My code to find the image size is something that I found online that works perfectly on it's own, however if I plug it into my script it does not return an image size for the first image I send it.
I've even tried sending it a dummy image just to 'prime the script' but that didn't work either. The first image from the database is returned full size unless I specify manually an initial size. But at some point in the loop, every image begins to be resized as it should be. It's all very strange and I think the problem comes down to passing a URL to the function.
Here is the section of my code that sets the URL of the image:
p_image = reviewSet("image") ' contains the URL
body = body & "<td align='center'><img src='" & p_image & "' alt='Picture' border='0' align='center' hspace='3' vspace='3' "
' The call of the function that returns 'True' or 'False'
if getSize(p_image,0,0,0,"") then
img_width = img_width * 1
img_height = img_height * 1
if img_width > img_height then
new_width = img_width / img_height
new_width = new_width * 80
body = body & "height='80' width='" & formatNumber(new_width,0) & "'"
else
new_width = img_height / img_width
new_width = new_width * 80
body = body & "height='" & formatNumber(new_width,0) & "' width='80'"
end if
else
body = body & "height='80'"
end if
body = body & " ></td>"
I know some of the code is not necessary, but it was part of my error checking. The variables 'img_height' and 'img_width' are the calculated height and width of the image.
This works fine if I call the function like this:
logo = reviewSet("image_name")
if getSize("http://www.local_server.com/" & logo,0,0,0,"") then
...
And it works fine if I call the function with a non-local server and simply print the height and width of the image, but when it's called as above there is nothing returned at all until a certain point that I can't seem to determine the cause. I think there is a problem with using a text string variable in the call of the function, but I don't know why.
I know I didn't post all of the code, it's fairly large, but if anyone can guess the problem from what I have above I would appreciate any information you can provde. I would prefer not to post books of code if possible, but if more is needed I will see what I can do.
If I define the variable in the function call as a string:
function getSize(URL as string, height, width, ...
Will that be a problem if I call the function with an actual string of text contained in quotes as opposed to a variable containing a string?
(I don't usually use Functions which is probably part of my problem.)