Jump to content

wendu

Members
  • Posts

    28
  • Joined

  • Last visited

    Never

Posts posted by wendu

  1. $maxWidth = 150;
    $maxHeight = 150;
    
    list($width, $height) = getimagesize('path/to/image');
    
    $ratio = 1;
    if ($width > $maxWidth) {
        $ratio = $maxWidth / $width;
    } else if ($height > $maxHeight) {
        $ratio = $maxHeight / $height;
    }
    
    $newWidth = $width * $ratio;
    $newHeight = $height * $ratio;

     

    yes you've given me this piece of code however it does not work if both the width and the hight are the same

  2. hey

     

    I'm trying to make a thumbnail of an image and I already have the code working to create the thumbnail

     

    however I need a way to calculate values so that respecting the aspect ratio I can make the thumbnail either 150 pixels wide or high but neither can go over 150, and the aspect ratio needs to stay the same

     

    thanks!! <33

  3. hey, it's wendu from sweden again!

     

    should I create two databases rather than just one where the other would contain data that is altered by users via PHP and the other will contain data that only authorised people can edit

     

    this way backiup would be simpler

     

    but is there any significan't drawback with two databases? even if I connect to them both using different php handles?

  4. Try removing the 'p.' from the '#wrapper p.info' part.

     

    I probably should've mentioned that I already have a working CSS link to the text I want to modify, the paragrapht

     

    I can do font-weight: bold and it works, but when I do margin-bottom: -1em; when about 100 lines above> margin-bottom: 1em is set to EVERY P within #wrapper

  5. There is not standard as far as blogs are concerned, but there is if you want to use correct grammar.  Why would you want to capitalize other letters?  I just don't understand any rationale behind it.

     

    for the very same reason news articles, books and movie titles are capitalized.

     

    how boring would this be

     

    The lord of the rings

     

    when it actually is

     

    The Lord of the Rings

     

    that's what I'm asking, how to know what words to make capital first letter and what not?

  6. hey'a!

     

    it's wendu here, with problems, d'oh :P

     

    I'm keeping my own Wp blog, but I can't seem to decide how to name my blog's titles!! the issue is what terms to make with capital first letter and what not?

     

    here's examples:

     

    Mike and his new bike

    or

    Mike and his New Bike

    or

    Mike And His New Bike

    or

    Mike and HIS new bike

     

    I'm so confused.. is there general rules what terms to capitalize? like the word "the" is better as "The"?

     

    share and discuss this, please. thanks!  :P

  7. do you mean you want to remove the margin bottom for .info that is in p that is in #wrapper? if yes then you wrote it correctly. you just need to put a space in between p and .info and change the value to remove it.

     

    I tried that and the CSS didn't work for that part after..

  8. hey

     

    I have a PHP script that can reduce the size of an uploaded image to a percent value, but I would like a way to calculate new values for an image of any size that are at or below 1280 x 960.

     

    if I use percent values for both the width and the height, it only works on images that are of specific size. sometimes the images are bigger and thus the percent values produce a bigger image than what I said above.

     

    thank you all, big hugs! - wendu

     

    edit: to be more clear, I want my script to reduce an image's size to 1280x960 or smaller, but maintaining the aspect ratio of the image, so both vertical and horizontal images would work well..

  9. hey

     

    I was wondering if there's a de-facto standard way or best practice when coding php

     

    should I make the whole document from startt to finish <?php ?> and then use echo everytime I need to print out html

     

    or should I start and end php tags only when php is needed? I'm presuming that loops have to be inside php at all times, and output is handled by echoing?

     

    can you post a sample of your code so I know how to start?

     

    big thanks. I'm a still learner

     

    edit: I mean is this a good way?

     

    <?php

     

    echo "<body onLoad=\"openSomething({$one})\">\n";

     

    ?>

     

    instead of

     

     

    <body onLoad="openSomething(<php? echo {$one}; ?>)">

     

  10. I've been able to work something out by changing the order of the DIV's and P's, but I'm not sure I can ask them to do that on production level

     

    however, what if I had something like this

     

    <p id="first" style="float: left;"></p>

    <p id="second" style="float: left;"></p>

    <p id="third" style="float: right;"></p>

     

    how can I make p with id third float on the same line as p with id first, without changing the order of the P's?

  11. I believe the way to do this is to put the right p first and the left p second, floating them both. If you don't want to change the order, then *maybe* you can set their display to inline, and try floating them as is. I don't know if that will work or not though.

     

    nope, thanks for your input but it didn't work

     

    here's my code

     

    <p style="float: left; display: inline;">This floats to the left</p>

    <p style="float: right; display: inline;">This floats to the right, NOW on the same line!</p>

  12. hey'as!

     

    it's about CSS floats.

     

    here's my code:

     

    <p style="float: left;">This floats to the left</p>

    <p style="float: right;">This floats to the right, BUT ON A SECOND LINE!</p>

     

    my problem is, how can I make these two P's float on the SAME LINE. I could do it by placing the last P first AND removing the float property from the last P, so it would look like this:

     

    <p style="float: right;">This floats to the right, NOW on the same line!</p>

    <p style="">This floats to the left</p>

     

    HOWEVER; I cannot change the order of these P's. I'm only doing CSS for this lil' project.

     

    do I need to set the width on these P's, change their display property or something? this has really been a headachhe

  13. Depending what you are trying to do with the referenced file you can either call it via a full path or referenced path.

     

    If you are in /var/temp and you you need to access /var/file.txt you can either reference it is ../file.txt or /var/file.txt

     

    If the file(s) are web accessible you could use the URL like for linking images.

     

    that's whaat I thought, so I need to use full reference. it's okay, really. :)

  14. Certainly!

     

    because I'm using SSI, and have includes (php requires) I can't change those includes when I go up a directory or down a directory, it has to know itself where I'm currently calling it from, and based on that make linkes to ROOT/contact.php work (instead of ROOT/temp/contact.php)

  15. hey

     

    a newb question

     

    how can I with PHP handle files that are in different folders?

     

    currently, when I'm inside temp and need to reference the folder that contains temp, and a file in it, I use

     

    ../index.php

     

    but sometimes it's not known at what level I am, so I could do a full reference, like http://example.com/index.php but that's not very wise I'm told

     

    also, depending on the platform, I cannot use /index.php because that might not always be the root, where the Web content is

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.