ok here is the sizing algorithm that will go into testing

if ($actualWidth>$actualHeight) {
if ($actualWidth > 350) {
# scale height to max width
$displayWidth = 350;
$displayHeight = int($displayWidth * $actualHeight / $acutalWidth);}
else {
$displayWidth = $actualWidth;
$displayHeight = $actualHeight;}
} else {
if ($actualHeight > 450) {
# scale width to max height
$displayHeight = 450;
$displayWidth = int($displayHeight * $actualWidth / $acutalHeight);}
else {
$displayWidth = $actualWidth;
$displayHeight = $actualHeight;}
}

One of the advantages of rich text editing is that you can paste code in the window :))

Tags

  1. programming
  2. picture size
  3. algorithms

Comments


Seth says
One prob is that i can apply that easily to uploads, but it would need to be installed deep in the rte code for pictures off the web ... oh well, just another challenge

Seth says
Note that there is no distortion taking place here. It either leaves the picture alone, if it will fit, or it scales it to the width, if that is where it does not fit, or it scales it to the height if that is where it does not fit.

Seth says
this algorithm has been deactivated, see 2815.

See Also

  1. Thought Dinking Pictures for Speak To Me Catalog with 30 viewings related by tag "PictureSize".
  2. Thought Footer problem on individual page at speaktomecatalog.com with 19 viewings related by tag "programming".
  3. Thought Promotions in the Speak To Me Catalog Shopping Basket with 8 viewings related by tag "programming".
  4. Thought Pride an Glory in Your Code with 4 viewings related by tag "programming".
  5. Thought SQL for selecting triples inside of one field. with 4 viewings related by tag "programming".
  6. Thought propogate logic from front door to rooms and refactor with 3 viewings related by tag "programming".
  7. Thought unzip for install.php with 2 viewings related by tag "programming".
  8. Thought about: Then each went to his own home with 1 viewings related by tag "programming".
  9. Thought about: try ruby! (in your browser) with 1 viewings related by tag "programming".
  10. Thought many useful php routines with 1 viewings related by tag "programming".
  11. Thought some thoughts on trans domain data transfer with 1 viewings related by tag "programming".
  12. Thought a good place to satisfy question~answer with 0 viewings related by tag "programming".
  13. Thought sources of php code with 0 viewings related by tag "programming".
  14. Thought sql explained for group tagroom with 0 viewings related by tag "programming".
  15. Thought related tags with 0 viewings related by tag "algorithms".
  16. Thought deactivate HTML in comments - or how and where to escape with 0 viewings related by tag "programming".
  17. Thought changing the picture size algorithm with 0 viewings related by tag "algorithms".
  18. Thought It's on our server now ... wonder if it works with 0 viewings related by tag "programming".
  19. Thought about: five years, building a culture, and handing it off. - laughing meme with 0 viewings related by tag "programming".
  20. Thought Perl regex with 0 viewings related by tag "programming".
  21. Thought tags and group names with 0 viewings related by tag "algorithms".
  22. Thought [title (1663)] with 0 viewings related by tag "programming".
  23. Thought tutorial for php classes with 0 viewings related by tag "programming".
  24. Thought This is a tutorial on the rte software with 0 viewings related by tag "programming".
  25. Thought work in progress for Chat Who's Here with 0 viewings related by tag "programming".
  26. Thought about: PEAR :: Package :: HTML_AJAX with 0 viewings related by tag "programming".
  27. Thought about: About image buttons in HTML forms (and multi-line texts in normal submit buttons) with 0 viewings related by tag "programming".
  28. Thought programming of edit tag with 0 viewings related by tag "programming".
  29. Thought visualization of clustering tag rooms with 0 viewings related by tag "algorithms".
  30. Thought about: joel bender - google+ - me, after blindly copying a load of code into a project with 0 viewings related by tag "programming".
  31. Thought Playing in the river with 0 viewings related by tag "programming".
  32. Thought testing mostly tag maintence with 0 viewings related by tag "programming".
  33. Thought the tag maintence window problem goes on with 0 viewings related by tag "programming".
  34. Thought Why does this work on his server and not on mine ? with 0 viewings related by tag "programming".
  35. Thought uploaded pictures will no longer be shown smaller than their natural dimensions with 0 viewings related by tag "picture size".