thumbnail size wrong

Rowald

Joined: 2005-06-05
Posts: 27
Posted: Tue, 2005-11-01 04:38

** Upgrade to Gallery 2.0.1 if you haven't already!
** http://gallery.menalto.com/gallery_2.0.1_released

Please fill out the following form and take a look at the linked pages. The more information you supply, the better we can help you.
FAQ:
- What information is required when asking for help in the forums?
http://codex.gallery2.org/index.php/Gallery2:faq#What_information_is_required_when_I_ask_for_help_in_the_forums.3F
- How to enable and use the debug mode of G2?
http://codex.gallery2.org/index.php/Gallery2:faq#How_to_set.2Fuse_Gallery_in_debug_mode.3F
- Known Issues (might explain your problem):
http://codex.gallery2.org/index.php/Gallery2:KnownIssues
- You can copy and paste a lot of the required information from "Site Admin" -> "Maintenance" -> "System Information" if your G2 is up and running.
- Is there a guide for migrating from G1 to G2 available?
http://codex.gallery2.org/index.php/Gallery2:migration


Gallery version (not just "2"):2.0.1
PHP version (e.g. 4.3.11):
PHPInfo Link (see FAQ):
Webserver (e.g. Apache 1.3.33):
Database (e.g. MySql 4.0.11):
Activated toolkits (e.g. NetPbm, GD):
Operating system (e.g. Linux):
Browser (e.g. Firefox 1.0):
--
For migration issues:
G2 URL (optional):stock.modelgraphy.com
G2 version: 2.0.1
G1 URL (optional):
G1 version:
G1 character set:
PHP memory limit:

Album thumbnails show sometimes with wrong dimensions. Height and Width is switched. Likely only when random thumbnail is enabled.

Rowald

 
fryfrog

Joined: 2002-10-30
Posts: 3236
Posted: Tue, 2005-11-01 05:03

It is due to your browser caching the image dimensions of the previous image. If you press shift-refresh, F5 or what ever reload button in your browser, it will be "fixed". You may also see this problem when you rotate an image or perhaps crop it.

One way I have found to "fix" it is to use the square thumbnail module. Since all thumbs are 1:1, you never have any odd dimension problems.
_________________________________
Support & Documentation || Donate to Gallery || My Website

 
Rowald

Joined: 2005-06-05
Posts: 27
Posted: Tue, 2005-11-01 06:38

I can't believe that and will verify against the source code next I see this. Anyhow, why don't you remove width and height so you will never have this problem? It certainly looks funny ;-)

 
fryfrog

Joined: 2002-10-30
Posts: 3236
Posted: Tue, 2005-11-01 06:53

You can make yourself see it by setting the random image timer very low (30 seconds?). I don't know why the image height/width is specified, perhaps something to do with standards compliance? Another solution (I'd think?) would be to simply not have the same url for the "new" image. I'd think this would fix it too.

I still think its a browser cache issue though... should be very easy to verify too. Just fire up your browser, let the page load with the current random image. Now, fire up another *new and different* browser after a few minutes (or what ever your time out is set to). I suspect the new, different browser won't have the problem and will look right initially, but the old opened one will.

_________________________________
Support & Documentation || Donate to Gallery || My Website

 
Rowald

Joined: 2005-06-05
Posts: 27
Posted: Tue, 2005-11-01 07:30

nope its wrong and its a bug. Its wrong in different browsers even in browser I didn't use for long, so nothing in the cache of those. The last test I started up Firefox, which I didn't use for long and never on this website and it showed stretched thumbnails. If one looks into the code its wrong, height and width is swapped.

 
Rowald

Joined: 2005-06-05
Posts: 27
Posted: Tue, 2005-11-01 07:36

just check the counts to see if it is an index error, but the count of landscape streched thumbnails doesn't match the actual number of landscape images, so this makes me assume, height and width is cached inside the gallery and not updated along with the thumbnails

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Tue, 2005-11-01 12:48

we explicitely define the height and width of all photos, videos, ... elements in g2 in the XHTML sourcecode since page rendering can start immediately if the dimensions of all elements are known.
else, you'd have to wait until all elements are downloaded and the page would change a little bit after each downloaded element.

the issue in question is already known / discussed in another topic.

i've just looked at the randomhighlight module code and it's correct. and i'm not sure, but i might have found the bug.

please open modules/randomhighlight/module.inc
replace

	    $ret = GalleryCoreApi::expireDerivativeTreeBySourceIds(array($thumbnail->getId()));
	    if ($ret->isError()) {
		GalleryCoreApi::releaseLocks($lockId);
		return $ret->wrap(__FILE__, __LINE__);
	    }[/code[
with

[code]
	    $ret = $thumbnail->expireCache();
	    if ($ret->isError()) {
		return $ret->wrap(__FILE__, __LINE__);
	    }
	    $ret = GalleryCoreApi::expireDerivativeTreeBySourceIds(array($thumbnail->getId()));
	    if ($ret->isError()) {
		GalleryCoreApi::releaseLocks($lockId);
		return $ret->wrap(__FILE__, __LINE__);
	    }

and then set the randomhighlight delay considerably low such that it changes a few times.
is it fixed?

 
Rowald

Joined: 2005-06-05
Posts: 27
Posted: Tue, 2005-11-01 19:15

Thanks for your response.

Nope it doesn't change. Some thumbnails show distorted still.

I went thru multiple refresh cycles, cleaned out the smarty cache and deleted the browser cache, but that didn't make a difference.

Ohh and sorry, I looked thru all the posts and didn't see, this was discussed before.

Thanks
Rowald

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Wed, 2005-11-02 03:51

ok, the above change is nonsense. i found out that this is already covered with $thumbnail->save();

but there are a couple of scenarios where we could end up with distorted random highlight thumbnails.

the reason is not that we cache the dimensions.
the reason is that we check and replace the randomhighlight on ShowItem and on DownloadItem requests.
ShowItem is the HTML page that we generate
DownloadItem is the actual <img src="here"> address of the thumbnail.

so if the randomhighlight delay is set to 0, then we choose in showItem a new random highlight thumbnail and a few milliseconds later we choose yet another thumbnail in the downloadItem request. the first could be landscape the second could be portrait, thus the portrait is displayed, but the html has hardcoded the dimensions of the landscape thumbnail.

another case where this could be a problem:
- randomhighlight delay: any
- showItem request is 1 ms before the delay expires, downloadItem is 1 ms after the delay expiration -> different thumbnails, possibly different dimensions

yet another case:
- showitem has begun outputting html but hasn't finished yet. browser receives the page and already calls downloaditem.
due to a current bug in g2 we commit the db transaction only at the very end of showitem but release the lock already right after the save() call. thus, we still have the old thumbnail data in the database when the downloaditem requests loads the thumbnail. thus the downloaditem request would could choose another thumbnail, since the selection is randomly.
- we're fixing this bug soon.

solution:
- a simple solution would be to only change the randomhighlight on showItem requests. i guess we'll do that.
in onLoad, if it's a downloadItem request, only replace the thumbnail if the current thumbnail is private and the user doesn't have permission to see it

 
Rowald

Joined: 2005-06-05
Posts: 27
Posted: Wed, 2005-11-02 04:34

Hi and thanks for the reply,

Oki I can follow your explanation and agree it should be one event only, which triggers generation of a new random thumbnail. Its no problem for me to look forward to the next version.

Thanks
Rowald

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Wed, 2005-11-09 18:24

fixed in cvs.
get tomorrows nightly snapshot to fix your g2.

 
hemsoe

Joined: 2004-09-09
Posts: 38
Posted: Thu, 2005-11-10 11:54

Hi...

Do this fix also fix the wrong sizes when thumbs are showed in album...??

/hemsoe

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Thu, 2005-11-10 13:04

i don't know what you're referring to.
this fixes only the randomhighlight bug.
please open a new topic if it's totally unrelated to randomhighlights.

 
hemsoe

Joined: 2004-09-09
Posts: 38
Posted: Thu, 2005-11-10 13:22

hi..
Well now in dought.. but as you can se in these pics.. the thumbs is not correct.. a F5 corrects it all.
But I am not able to update to the lastes version on my server for the moment, but if any of you could tell if the problem is solve. I would be glad to know.

AttachmentSize
after.jpg99.88 KB
before.jpg105.66 KB
 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Thu, 2005-11-10 13:27

if these 3 items are albums and if you are using the randomhighlight module, then it's solved.
if not, then it's something else that i haven't seen yet. and you'd have to create a new topic and supply more information.

 
hemsoe

Joined: 2004-09-09
Posts: 38
Posted: Thu, 2005-11-10 13:50

hi Valiant...

I will report back when I have the chance to update the server.. thx...

/hemsoe

 
hemsoe

Joined: 2004-09-09
Posts: 38
Posted: Mon, 2005-11-14 15:10

Hi...

I tried to make a "rebuild thumbs/rezised"... and that seems to do the trick...
I have been using the square thumb plug-in, don't know why, standart installation... i think..

But there have been some pictures the didn't have the correct information.. they had the square infomation..
thx..

hemsoe

 
Rowald

Joined: 2005-06-05
Posts: 27
Posted: Mon, 2005-11-14 18:10

nope ... that square modul has nothing to do with this bug.

Also, I was informed, that this has been fixed in the CVS already!

Rowald

 
Rowald

Joined: 2005-06-05
Posts: 27
Posted: Thu, 2006-01-26 19:44

BTW ... problem persists in 2.0.2

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Thu, 2006-01-26 22:25

g 2.0.2 is basically 2.0 with security fixes. it's doesn't have any other patch fixes.
use the latest nightly snapshot if you want a g2 version where this stuff is fixed.

 
Rowald

Joined: 2005-06-05
Posts: 27
Posted: Thu, 2006-01-26 22:53

ohh ... it was just a hint for you guys

thanks