Issue with embedding image in caption

Page: 1

Author Post
netslider
Guest
I'm not so much having a problem with embedding the image. I can do that no problem. What my issue is is that when you first click the link, the image is very much off format.. but if you click next or just close it and re-open it, the image is formatted correctly.

how can I go about fixing this?

for an example, please go to http://www.josephst.com/example.html

thanks!
Administrator
Registered: Aug 2008
Posts: 3382
Hmmm, it never occurred to me that someone would put an image inside the caption.

I'm pretty sure I know why it's not sizing right the first time. The code builds the caption and the rest of the lower panel and measures it to determine the overall size of the floatbox. On the first load of that lower panel the embedded image has not yet finished loading when the measurements are taken and so the caption div has not yet sized to its final height to accommodate the image. The measurements are wrong. On subsequent loads the image is in cache and so is available to take its place inside the caption when the panel is measured.

I did some quick testing. Setting the width and height in the img tag seems to be enough to get proper sizing on first pass. In your case it looks like this:
<img src="http://www.josephst.com/beta/blank_3_files/pssnewlogo.gif" width="198" height="60">
(Escaped html sure looks ugly.)

Another approach could be to force preloading of the image by putting a floatboxed empty anchor on the host page. Put it right after the body tag so it preloads first. This would look like:
<body>
<a href="/beta/blank_3_files/pssnewlogo.gif" rel="floatbox"></a>
...

If you're paranoid like me, you'd do both these things.
netslider
Guest
Once again you were right! Thank you again!!!

Page: 1