This page is part of the BugReports series. Please go there to submit a new bug or to see the list of all existing reports.


image scaling

ewiki version R1.01e
operating system Linux
database backend mysql
php version 5.0.x
bug category general
status frozen

Arun : (same problem with the version installed at sf.net on 2004-12-1)

just tried to uploading a picture, everything worked fine unitl I added a "?x=200&y=200" at the end of the image (as described in the help file)...

the problem: the ?x=... also shows up in the internal link and therefore the database can't find the image.

solution: add something like the following to ewiki_link_img

if($x && $y)
  $size = " width=\"$x\" height=\"$y\"" ;
else if($x)
  $size = " width=\"$x\" " ;
else if($y)
  $size = " height=\"$y\" " ;
else
  $size = "";

if (strpos($href,"%3Fx")) $href= substr($href,0,strpos($href,"%3Fx"));

this also allows to scale a picture by just given either x or y size (keeping the aspect ratio)

Jochen: Recently I wanted to use only x trying to limit the width to maybe 640 but keeping the aspect ratio. Looking at selfhtml.org I'm not sure if a width parameter without a height parameter in an img tag is correct syntax. If it is it should be definitely implemented as suggested above. *vote* It's too stupid to show up the width and height of several images and to calculate the new height manually only to keep the ratio...

mario: Right now I'm more concerend with the *ConditionalHttpRequests/caching problem, but I'll apply the fix afterwards. I don't see the problem not to allow rescaling only with x= or y=, since both are already cached as meta data AFAIremember.

Not having the ?x=&y= appear in the {refs} field is a bit more tricky, the code for the quick link prescanning is not so clean and extensible to make that work out of the box. However it was functional in some point in the past, only have to look up what broke it...

bottom corner