Author Topic: Flash files keep smaller but not bigger then set size?  (Read 10007 times)

0 Members and 1 Guest are viewing this topic.

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Flash files keep smaller but not bigger then set size?
« on: November 28, 2002, 10:53:16 PM »
I would like show FLASH files with size not larger then 800x800. so, when I change /templates/media/swf.html temlate with width="800" height="800" instead of {width_height}, then it's displays exactly 800x800 and if FLASH file originaly 200x100 ti will have white canvas on top and bottom. so, my question is, where I can add something that can resize proportionly FLASH files? to keep them original size if the size smaller or equal 800x800, or make it smaller to that size?
hope that's can be done.

[EDITED]
I figured how to do that. but now I have another question:
what is the math formula to resize rectangle proportionaly?  :roll:
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Flash files keep smaller but not bigger then set size?
« Reply #1 on: November 29, 2002, 02:45:46 AM »
well, I figured the formula, but not sure if it's the simplest one.
so if someone need it here is my code:

1. open functions.php file
2. search for:
Code: [Select]

    $src = (!file_exists($media_src) && file_exists(preg_replace("/\/{2,}/", "/", get_document_root()."/".$media_src))) ? preg_replace("/\/{2,}/", "/", get_document_root()."/".$media_src) : $media_src;
    if ($image_info = @getimagesize($src, $info)) {
      $width_height = " ".$image_info[3];
      $width = $image_info[0];
      $height = $image_info[1];

add after:
Code: [Select]
     $height_limited = 800;
      $width_limited = 800;
      $dimension = $width_limited;
      if ($width > $width_limited || $height > $height_limited && !$width && !$height) {
      $ratio = $width / $height;
   if ($ratio > 1) {
     $width_limited = $dimension;
     $height_limited = floor(($dimension/$width) * $height);
   }else{
     $width_limited = floor(($dimension/$height) * $width);
     $height_limited = $dimension;
}
}elseif ($width || $height) {
$width_limited = $width;
$height_limited = $height;
}

4. in same file search for:
Code: [Select]
     "height" => $height,
5. add after:
Code: [Select]
     "width_limited" => $width_limited,
      "height_limited" => $height_limited,

now u can use
{width_limited} or {height_limited} in your templates.
so, if u want limit your pictures, flash files, video files, etc. size u can change
Code: [Select]
{width_height}to this:
Code: [Select]
width="{width_limited}" height="{height_limited}"
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline Takeo

  • Pre-Newbie
  • Posts: 4
    • View Profile
Re: Flash files keep smaller but not bigger then set size?
« Reply #2 on: August 09, 2005, 12:30:54 AM »
I was looking for a solution to my site and I think I've got the same problem.
I've posted in here my problem: http://www.4homepages.de/forum/index.php?topic=9219.0

I'm currently working with large images and they don't fit on the default theme, so they expand her. I want to maintain the original size of the images, so that when we right click on them and select "Save as..." it saves with their original size. But I want that they are displayed with a smaller size.
For example, every image superior to 450px must be presented in the details and comments page with 450px. And every image smaller that 450px must stay on their size.

Another thing, I haven't understood the step next to the 5th. :S

Please help me out!!!
Thanks!

Offline universal

  • Full Member
  • ***
  • Posts: 213
    • View Profile
    • http://www.funny.lt
Re: Flash files keep smaller but not bigger then set size?
« Reply #3 on: August 12, 2005, 05:19:53 AM »
Code: [Select]
<!-- Template file for Flash Movies -->
<table cellpadding="1" cellspacing="0" border="0">
  <tr>
    <td bgcolor="#000000">
  <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="700" />
      <param name="movie" value="{media_src}">
      <param name="quality" value="high">
      <param name="play" value="true">
      <param name="scale" value="false">
      <embed src="{media_src}" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash"{width_height}></embed></object></td>
  </tr>
</table>
width="{width_limited}" height="{height_limited}"

i`ve insterted "width="{width_limited}" height="{height_limited}"" into source of template, but you can see...
there is only width="" height=""

where can the problem be?
http://www.funny.lt/details.php?image_id=8045
Again this addres?!
http://www.funny.lt