yoja Posted October 5, 2002 Share Posted October 5, 2002 Hi, I've created a piece of code to have my articles being put in a box which i specify by giving the image's widht and height. The code checks takes the longes side and calculates the ratio according to it. If added this piece of code to the html_output tep_image() It only performs the action to the pictures starting with ar, cause my article pictures al start with ar. Maybee more people like it this way and the code can be part of the new version. if ( ($width) && ($height) ) { if ($image_size = @getimagesize($src)) { $height_full = $image_size[1]; $width_full = $image_size[0]; if ($height_full > $width_full) { $ratio = $height / $height_full; } else { $ratio = $width / $width_full; } // only apply this trick for the images of the articles if (substr ($src, 0, 9) == "images/ar") { $height = $height_full * $ratio; $width = $width_full * $ratio; } $image .= ' width="' . $width . '" height="' . $height . '"'; } } Quote Link to comment Share on other sites More sharing options...
CC Posted October 5, 2002 Share Posted October 5, 2002 Have you got a link so we can see this working?? I would like to see what you mean exactly. Thnx CC. Quote Link to comment Share on other sites More sharing options...
yoja Posted October 7, 2002 Author Share Posted October 7, 2002 I don't have a working link yet, everything works local only :-( The system means that picture's are resiced so that they can fit in a box. If you've got a picture of 200 widht/100height and you've difined the picture to be of size 100 100, what the system wil do is the following: it will find that width is the biggest, calculate the ratio as being 0.5 and then multiply the picture sizes with it. The new widht wil become 100, and the height 50 the picture now fits in the 100x100 box and stil keeps its ratio! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.