Limiting uploaded image width in user-posted content?

Ask a Question related to Coldfusion - Getting Started, Design and Development.

  1. #1

    Default Limiting uploaded image width in user-posted content?

    I have created a blogging system where users can upload pics to their
    galleries then place them into their blogs by way of <img> tags. The problem
    is, when the image is over 550 pixels in width, it blows up the tables in
    the website. I have already warned them not to put huge images in the blogs
    and have limited the filesize, but there is no way to stop people. Even
    posting this warning it in bright red, super large text does not seem to put
    a dent it in.

    Is there a way to limit the width of an uploaded image?

    If not, is there a way to scan for image tags with width greater than 550
    and then replace the width attribute?


    Franklin Cross Guest

  2. Similar Questions and Discussions

    1. Limiting Editing to specific page content
      I bought this product for this specific reason from the Adobe sales literature: "With Adobe Contribute 4, site administrators can ensure that only...
    2. #40472 [NEW]: Semi random characters posted along with page content
      From: fuitad at gmail dot com Operating system: FreeBSD PHP version: 5.2.1 PHP Bug Type: Output Control Bug description: ...
    3. Limiting table width?
      I've noticed that tables have a way of horizontally wandering outside of their containing frames. Is there any way to limit and/or set a table's...
    4. rewriting posted content for use in redirect
      similar to a recently asked question - The scenario is that posted data from World Pay is to be used to construct one of two pages depending on...
    5. limiting software installation to specific user(s)
      Many software packages now ask, during installation, whether the installation is limited to the current user/installer or if it's for all users. ...
  3. #2

    Default Re: Limiting uploaded image width in user-posted content?


    "Franklin Cross" <CrossBaby111@hotmail.com> wrote in message
    news:Deq9f.30859$ol.30690@fe08.lga...
    >I have created a blogging system where users can upload pics to their
    >galleries then place them into their blogs by way of <img> tags. The
    >problem is, when the image is over 550 pixels in width, it blows up the
    >tables in the website. I have already warned them not to put huge images in
    >the blogs and have limited the filesize, but there is no way to stop
    >people. Even posting this warning it in bright red, super large text does
    >not seem to put a dent it in.
    >
    > Is there a way to limit the width of an uploaded image?
    >
    > If not, is there a way to scan for image tags with width greater than 550
    > and then replace the width attribute?
    >
    Something like this: (you might will need to set the:
    #ExpandPath('#ServerFile#')# )

    <!--- :: Get image width and height --->
    <cfobject type="JAVA" action="Create" name="tk" class="java.awt.Toolkit">
    <cfobject type="JAVA" action="Create" name="img" class="java.awt.Image">
    <cfscript>
    img = tk.getDefaultToolkit().getImage("#ExpandPath('#Ser verFile#')#");
    Width = img.getWidth();
    Height = img.getHeight();
    </cfscript>
    <!--- :: Get image width and height :: --->

    <cfif Width GT 550>
    no no Width is to much!
    <cffile action = "delete" file = "#ExpandPath('#ServerFile#')#">
    </cfif>

    <cfif Height GT 550>
    no no Height is to much!
    <cffile action = "delete" file = "#ExpandPath('#ServerFile#')#">
    </cfif>


    Noël® Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139