1.2.1 Need help with image dimension and whitespace script

Discussion in 'Modding/Theme Help' started by BabyDunk, Mar 3, 2017.

  1. BabyDunk

    BabyDunk Active Member

    Joined:
    Feb 26, 2017
    Messages:
    279
    Likes Received:
    22
    Hello and thanks for having a look ;)

    i am new to WeBid but i am enjoy settings it up and editing the the modern theme to my liking.

    i am a noob as my signature suggests but i have a small bit of knowledge with editing code and roughly understanding with what the code is saying, not enough that i could write anything that would be useful but i am here to learn just as i am at osclass to learn also.

    now to my problem. i am have trouble with images, especially on the home page. if an img is uploaded with a different dimension to the other img already on homepage. the page looks hideous with big gaps . i know i can reduce the max-height to say 120px but the the img looks distorted in some cases .

    well i found a script over at StackOverflow stackoverflow.com/questions/4478223/how-do-i-fill-white-background-while-resize-image

    the script i believe writes the image scaled to a white background and adds a watermark if one is present, to a pre-defined hieght and width.

    heres the script
    PHP:
    <?php
    function resize($source_image$destination$tn_w$tn_h$quality 100$wmsource false)
    {
        
    $info getimagesize($source_image);
        
    $imgtype image_type_to_mime_type($info[2]);

        
    #assuming the mime type is correct
        
    switch ($imgtype) {
            case 
    'image/jpeg':
                
    $source imagecreatefromjpeg($source_image);
                break;
            case 
    'image/gif':
                
    $source imagecreatefromgif($source_image);
                break;
            case 
    'image/png':
                
    $source imagecreatefrompng($source_image);
                break;
            default:
                die(
    'Invalid image type.');
        }

        
    #Figure out the dimensions of the image and the dimensions of the desired thumbnail
        
    $src_w imagesx($source);
        
    $src_h imagesy($source);


        
    #Do some math to figure out which way we'll need to crop the image
        #to get it proportional to the new size, then crop or adjust as needed

        
    $x_ratio $tn_w $src_w;
        
    $y_ratio $tn_h $src_h;

        if ((
    $src_w <= $tn_w) && ($src_h <= $tn_h)) {
            
    $new_w $src_w;
            
    $new_h $src_h;
        } elseif ((
    $x_ratio $src_h) < $tn_h) {
            
    $new_h ceil($x_ratio $src_h);
            
    $new_w $tn_w;
        } else {
            
    $new_w ceil($y_ratio $src_w);
            
    $new_h $tn_h;
        }

        
    $newpic imagecreatetruecolor(round($new_w), round($new_h));
        
    imagecopyresampled($newpic$source0000$new_w$new_h$src_w$src_h);
        
    $final imagecreatetruecolor($tn_w$tn_h);
        
    $backgroundColor imagecolorallocate($final255255255);
        
    imagefill($final00$backgroundColor);
        
    //imagecopyresampled($final, $newpic, 0, 0, ($x_mid - ($tn_w / 2)), ($y_mid - ($tn_h / 2)), $tn_w, $tn_h, $tn_w, $tn_h);
        
    imagecopy($final$newpic, (($tn_w $new_w)/ 2), (($tn_h $new_h) / 2), 00$new_w$new_h);

        
    #if we need to add a watermark
        
    if ($wmsource) {
            
    #find out what type of image the watermark is
            
    $info    getimagesize($wmsource);
            
    $imgtype image_type_to_mime_type($info[2]);

            
    #assuming the mime type is correct
            
    switch ($imgtype) {
                case 
    'image/jpeg':
                    
    $watermark imagecreatefromjpeg($wmsource);
                    break;
                case 
    'image/gif':
                    
    $watermark imagecreatefromgif($wmsource);
                    break;
                case 
    'image/png':
                    
    $watermark imagecreatefrompng($wmsource);
                    break;
                default:
                    die(
    'Invalid watermark type.');
            }

            
    #if we're adding a watermark, figure out the size of the watermark
            #and then place the watermark image on the bottom right of the image
            
    $wm_w imagesx($watermark);
            
    $wm_h imagesy($watermark);
            
    imagecopy($final$watermark$tn_w $wm_w$tn_h $wm_h00$tn_w$tn_h);

        }
        if (
    imagejpeg($final$destination$quality)) {
            return 
    true;
        }
        return 
    false;
    }

    resize('teszt2.jpg''out.jpg'100100);
    ?>
    <img src="out.jpg">
    then i call the script with a bit of help from the automatic resize and watermark resource and adding the extra inputs
    PHP:
    -// Copy files
                
    foreach ($UPLOADED_PICTURES as $k => $v)
                {
                    
    $source_image=(UPLOAD_PATH session_id() . '/' $v);
                    
    $destination=(UPLOAD_PATH $auction_id '/' $v);
                    
    resize($source_image$destination1368770);
                    
    chmod(UPLOAD_PATH $auction_id '/' $v0777);
                    }

    is this script usable with WeBid. i have very limited understanding of php to know how to fix this. i am trying all the same. Code Accademy is good for that and forums and of course hands on projects :D

    Thanks in Advance :)
     
    Last edited: Mar 3, 2017
  2. BabyDunk

    BabyDunk Active Member

    Joined:
    Feb 26, 2017
    Messages:
    279
    Likes Received:
    22
    i found this class but i cant same to call it either. i know i dont have a clue what im doing. i cant even see how the image would return back the auction dir with this class. some i presume there nee some added code :oops:

    maybe someone with better understanding can have a look

    PHP:
    <?php

    // only process image files
    $accepted_extensions = array( 'jpg''jpeg''png' );

    // set final size of cropped image
    $image_size_width 892;
    $image_size_height 892;

    //only process files in directory that script is in
    $dir realpathdirname__FILE__ ) );
    $files scandir$dir );


    foreach( 
    $files as $file ) {

        
    // get file / path info
        
    $file_info pathinfo$file );
       
        
    // only process actual files
        
    if( isset( $file_info['extension'] ) AND isset( $file_info['filename'] ) ) {
           
           
            
    // get the file extension
            
    $extension $file_info['extension'];
           
            
    // only process image files with acceptable extensions
            
    if( in_array$extension$accepted_extensions ) ) {
               
                
    // instantiate resizer
                
    $im = new CropImage$file );
               
                
    //create resized jpg @ default quality and overwrite original file
                
    imagejpeg$im->crop(892,892), $file_info['filename'] . '.jpg' );
               
                
    // cleanup
                
    unset( $im );
            }
        }           
    }

    /*
    This class Copyright (C) 2008 Alex Poole

    This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.

    This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

    You should have received a copy of the GNU General Public License along with this program; if not, see <http://www.gnu.org/licenses>.
    */

    class CropImage{

        
    //get original image & turn into a resource
       
        //get required dimensions
       
        //resize image to required dimensions within aspect ratio
       
        //check whether width or height are wrong
       
        //get number of pixels required to pad either width or height
       
        //halve them (or nearly halve them, with a one pixel offset if the total padding amount is an odd number)
       
        //add equal amount of whitespace on each half of the image, either vertically or horizontally
       
        //return the resource
       
        
    function __construct($imgurl){
            
    $this->imgurl $imgurl;
            
    $this->imgsize = @getImageSize($imgurl);
            if (!
    $this->imgsize){
                return 
    false;
            }
            if ( 
    substr(strtolower($imgurl), -4) == "jpeg" || substr(strtolower($imgurl), -3) == "jpg"){
                
    $this->orig_im ImageCreateFromJPEG($imgurl);
            } else {
                
    $this->orig_im ImageCreateFromPNG($imgurl);
            }
        }
       
        function 
    crop($w$h){
            
    $newim $this->resizeImage($this->orig_im$this->imgsize[0], $this->imgsize[1], $w$h);
           
            
    //return Array($newImage, $neww, $newh);
            
    if ($newim[1] < $w || $newim[2] < $h){
                
    //add more width or height
               
                //create new white image
                
    $paddedimg imagecreatetruecolor($w$h);
                
    $white imagecolorallocate($paddedimg,255,255,255);
                
    imagefill($paddedimg00$white);
                
    //stick the thumb in the middle of the new white image
                
    $pastex floor(($w $newim[1]) / 2);
                
    $pastey floor(($h $newim[2]) / 2);
               
                
    imagecopy($paddedimg$newim[0], $pastex$pastey00$newim[1], $newim[2]);
               
                
    //imagefill($paddedimg, 0, 0, $white);
               
                
    return $paddedimg;
            
    /*
            bool imagecopymerge ( resource $dst_im , resource $src_im , int $dst_x , int $dst_y , int $src_x , int $src_y , int $src_w , int $src_h , int $pct )
            Copy a part of src_im onto dst_im starting at the x,y coordinates src_x , src_y with a width of src_w and a height of src_h . The portion defined will be copied onto the x,y coordinates, dst_x and dst_y .
            */

            
    } else {
                
    //pass through
                
    return $newim[0];
            }
           
        }
       
        function 
    resizeImage($image$iw$ih$maxw$maxh){
            if (
    $iw $maxw || $ih $maxh){
                if (
    $iw>$maxw && $ih<=$maxh){//too wide, height is OK
                    
    $proportion=($maxw*100)/$iw;
                    
    $neww=$maxw;
                    
    $newh=ceil(($ih*$proportion)/100);
                }
               
                else if (
    $iw<=$maxw && $ih>$maxh){//too high, width is OK
                    
    $proportion=($maxh*100)/$ih;
                    
    $newh=$maxh;
                    
    $neww=ceil(($iw*$proportion)/100);
                }
               
                else {
    //too high and too wide

                    
    if ($iw/$maxw $ih/$maxh){//width is the bigger problem
                        
    $proportion=($maxw*100)/$iw;
                        
    $neww=$maxw;
                        
    $newh=ceil(($ih*$proportion)/100);
                    }
                   
                    else {
    //height is the bigger problem
                        
    $proportion=($maxh*100)/$ih;
                        
    $newh=$maxh;
                        
    $neww=ceil(($iw*$proportion)/100);
                    }
                }
            }
           
            else {
    //copy image even if not resizing
                
    $neww=$iw;
                
    $newh=$ih;
            }
           
            if (
    function_exists("imagecreatetruecolor")){//GD 2.0=good!
                
    $newImage=imagecreatetruecolor($neww$newh);
                
    imagecopyresampled($newImage$image0,0,0,0$neww$newh$iw$ih);
            } else {
    //GD 1.8=only 256 colours
                
    $newImage=imagecreate($neww$newh);
                
    imagecopyresized($newImage$image0,0,0,0$neww$newh$iw$ih);
            }
            return Array(
    $newImage$neww$newh);
        }

    }
    //class

    //end file
     
  3. MJAuction

    MJAuction Member

    Joined:
    Mar 24, 2015
    Messages:
    43
    Likes Received:
    1
    Good find! I too am trying to fix the image distortion and the large image gaps... I'm reluctant to spend more on advertising until it's fixed... Hopefully we can solve it. Users can't be bothered with resizing their pictures. Most of my users use their phone or iPad camera and browser. Most phone cameras take portrait shots where as iPad's are set to take landscape shots, so it's all over the place. It has to be easy for users as snapping, uploading, and seeing flawlessly. Code Academy is definitely a good learning resource... I should use it more often...
     
    Last edited: Mar 5, 2017
  4. BabyDunk

    BabyDunk Active Member

    Joined:
    Feb 26, 2017
    Messages:
    279
    Likes Received:
    22
    Hi @MJAuction

    yes we definitely need this problem sorted out. nothing worse than visiting a site with a messed up layout or poor image quality and that's what we get at present :(

    i wish i knew how to code so badly and no matter how hard i try i just can't remember . i learn something one day and for get the next lol head like a sieve o_O but i keep trying and i love it to especially when i figure something out on my own but this i don't know what i'm doing wrong or even if the code is correct. it looks it but what do i know haha

    i hope someone with more experience can have a look and maybe add a new feature to WeBid ;)
     
  5. nay27uk

    nay27uk Super Moderator Staff Member

    Joined:
    Nov 24, 2009
    Messages:
    5,569
    Likes Received:
    544
    There is no need for all this extra stuff just a simple CSS style change will do all what you want.

    Just open the file themes/modern/css/style.css

    Find this code
    PHP:
    .featured-item {
        
    min-height230px;
        
    border1px solid transparent;
        
    border-color#DDD;
        
    margin-bottom10px;
    }
    Replace with this code
    PHP:
    .featured-item {
        
    height230px;
        
    border1px solid transparent;
        
    border-color#DDD;
        
    margin-bottom10px;
    }
    Log in to your WeBid admin and on the first page after log in scroll down and click on the clear template cache button.

    If using Google Chrome also take the next steps.

    1. In chrome click on the three dots icon to the top left of the browser and choose history from the list.
    2. On the left of the new menu that comes up click History again, this opens the history window.
    3. Click the Clear Browsing Data link to the left of the window this will open a new window in the middle of the screen.
    4. From the dropdown box in this new window choose THE BEGINNING OF TIME and then tick every box apart from PASSWORDS and AUTO FILL FORM DATA.
    5. Click on the CLEAR BROWSING DATA BUTTON.
    6. When done close your browser and re open it and go to your WeBid site.
    The above steps should make them all look level, if they all look level in a browser on a computer now, but they are still not level on a mobile device, then all you need to do is just add back the min-height element so the code will be.

    PHP:
    .featured-item {
        
    min-height230px;
        
    height230px;
        
    border1px solid transparent;
        
    border-color#DDD;
        
    margin-bottom10px;
    }
    Even with a min-height element it is always good practice to also add a height element, min-height is the minimum height for a given element whereas height is the overall height of an given element the min-height element should usualy be smaller than the height element but in this case I don't think it matters as other div elements keep it surrounded.
     
    Last edited: Mar 7, 2017
  6. BabyDunk

    BabyDunk Active Member

    Joined:
    Feb 26, 2017
    Messages:
    279
    Likes Received:
    22
    Hey @nay27uk thanks for your post

    that doesn't help when your site is bootstrap responsive an you hit 767px with a width:100% and if i gave it a fixed width @media screen sizes there would be far to much free space and even with that. if i upload an image that has a tall image height then the image gets badly distorted and if the image is 16:9 letterbox the image gets badly distorted and not only also get trouble in the item page. if i fix the height to keep page layout then i get image distortion

    the only way i can see for to get an optimal image is to have the original image placed onto a 4:3 white background. where the original image dimension is scaled correctly with no distortion .

    if only we could get that script working above it would be very beneficial to the rest of WeBid users. have you checked over the code @nay27uk? or is @renlok the man to have a look as i see that he/she does a lot of work on the WeBid script

    Thanks again for you message
    BabyDunk
     
  7. nay27uk

    nay27uk Super Moderator Staff Member

    Joined:
    Nov 24, 2009
    Messages:
    5,569
    Likes Received:
    544
    Then why not make use of the responsive elements already part of bootstrap and as well as my code also add an img- responsive class to the other class in the image tag.

    Like this
    PHP:
    <IMG class="img-center img-responsive">
    Where img- center is the class already there.
    You could probably get away with leaving the heights as they are but just add the img- responsive class to the other class in the IMG tag
     
    Last edited: Mar 8, 2017
  8. BabyDunk

    BabyDunk Active Member

    Joined:
    Feb 26, 2017
    Messages:
    279
    Likes Received:
    22
    Thanks for the reply but i still need the script to work. images are still distorted at all responsive sizes depending on the image dimension uploaded will determine the amount of distortion.

    does no one else have this problem?

    images taken after your settings set.

    [​IMG] [​IMG]
     
  9. nay27uk

    nay27uk Super Moderator Staff Member

    Joined:
    Nov 24, 2009
    Messages:
    5,569
    Likes Received:
    544
    have you not seen the reply to the other thread asking the same question about images being blured? you need to change the thumbnail size in the admin side HERE IS THAT THREAD

    This is the reason the forum rules state to use the forum search before posting, this thread, as well as the one I linked to above is possibly the 5th or 6th time this same question regarding blurred images has been asked and resolved
     
    Last edited: Mar 8, 2017
  10. BabyDunk

    BabyDunk Active Member

    Joined:
    Feb 26, 2017
    Messages:
    279
    Likes Received:
    22
    yes i have seen your reply and that thread and my thumbnail size is set to 408px can't really go much bigger . wouldn't be a thumbnail then. and alls i do is search the forum but obviously no support for my problem apart from css rules which won't fix my dilemma, hence this thread.

    i dont want to compromise on image quality or page layout .
     
  11. nay27uk

    nay27uk Super Moderator Staff Member

    Joined:
    Nov 24, 2009
    Messages:
    5,569
    Likes Received:
    544
    Support is member based.
    webid is a community driven script and support is from other members helping and answering other members questions, so if my suggestions have not helped you there is nothing more I can do to help you myself, so you will have to wait until any other members of the forum may be able to help you.

    If you are expecting replies from a dedicated support team then you will be waiting a very very long time because there are none, the members of this forum are the support.

    I have been with webid a long time that's why I was made a moderator, in my time here I have almost learned the script inside out as well as having made a lot of themes for webid including custom themes for other members, I have answered your above questions using my own experience of webid as well as pointed you to other threads of others that have had your problem.

    Unfortunately if you don't even try the suggested fixes as well as the thumb sizes fixes then members are stuck to help.

    You will be hard pushed to find any member of the forum that will just drop all they are doing to get their own webid sites working just to help you recode your above code so it works for you, you may if patient enough get a member eventually if they get time, that may take a look and help re code it to work with webid but patients is the key here as support is member based and all members here have their own lives outside of webid as well as trying to get their own webid sited working how they want.
     
    Last edited: Mar 8, 2017
  12. BabyDunk

    BabyDunk Active Member

    Joined:
    Feb 26, 2017
    Messages:
    279
    Likes Received:
    22
    I thank you for your replies and I fully understand how this works. I will wait until i can either figure this out or someone can help me and when either comes, It will be here for the community


    Cheers
    BabyDunk
     
  13. nay27uk

    nay27uk Super Moderator Staff Member

    Joined:
    Nov 24, 2009
    Messages:
    5,569
    Likes Received:
    544
    No problem glad you understand.

    I can take a look next week but at this moment in time I have my partner here as she has just come out of hospital after having a breast rebuild after having breast cancer so that is my priority until maybe Tuesday next week.

    Being a none PHP coder I need to be totally alone to even attempt to work PHP out let alone alter it to work in webid.

    Soon as she is well enough to go home I will take a look and try to help if I can.

    Good luck in the mean time though.
     
  14. BabyDunk

    BabyDunk Active Member

    Joined:
    Feb 26, 2017
    Messages:
    279
    Likes Received:
    22
    Im sorry to hear your misses is having such severe health problems. God Bless her and I hope she gets to a full recovery ASAP.

    Take your time @nay27uk i'm sure this forum can operate without you for awhile

    I would be pretty much the same with php but I am learning a lil everytime. I have always had a bad memory but just recently found out my amalgam fillings were poisoning me . so since had them replaced and currently on a detox plan, hope my brain function gets alot better. all this coding stuff is very addictive and i dream of being able to code php and javascript from scratch lol lets hope its not only a dream haha


    Talk soon mate and all the best ;)
     
    nay27uk likes this.
  15. hhavatar

    hhavatar Donor Donor

    Joined:
    Jul 28, 2014
    Messages:
    747
    Likes Received:
    74
    Sorry to hear about your wife @nay27uk. Thoughts and prayers are with you both. Hope she comes through ok.
     
    BabyDunk and nay27uk like this.
  16. nay27uk

    nay27uk Super Moderator Staff Member

    Joined:
    Nov 24, 2009
    Messages:
    5,569
    Likes Received:
    544
    Thanks both she is a few years the other side of the cancer now but only just had the reconstruction done.

    I will most definetley have a fiddle with the code when I can.

    My memory is also terrible, well my short term memory is my long term I can remember as far back as being in my pram.

    Anyway thanks both and let's try and get things back on subject now.

    Give me till Tuesday and I will help if nothing has been done.
     
    BabyDunk likes this.
  17. BabyDunk

    BabyDunk Active Member

    Joined:
    Feb 26, 2017
    Messages:
    279
    Likes Received:
    22
    OOOOOH YEAAAY

    got it working perfectly . the problem was that the original uploaded link and img was still being used . turns out you need to destroy the original image and unlink so that the new img can be used and now all my images are the same dimensions and all layouts from home to item page all uniform :):cool::D;)


    if you would like all images uploaded to have the same dimension without loosing picture quality and scaled exact to the original image plus add a watermark then follow the steps below

    all editing will take place in sell.php in the WeBid root dir

    Under this
    PHP:
    $_SESSION['action'] = (!isset($_SESSION['action'])) ? $_SESSION['action'];
    $_SESSION['action'] = (!isset($_POST['action'])) ? $_SESSION['action'] : $_POST['action'];
    $ERR 'ERR_';
    $_SESSION['SELL_editing_category'] = false;
    $catscontrol = new MPTTcategories();
    Add this
    PHP:
    // Image Resizer and Watermark
    function resize($source_image$finished$tn_w$tn_h$quality 100$wmsource false)//if you wish to add a watermark replace ' $wmsource = false '  for the watermarks location ' $wmsource = "path_to_warkmark.png" '
    {
        
    $info getimagesize($source_image);
        
    $imgtype image_type_to_mime_type($info[2]);

        
    #assuming the mime type is correct
        
    switch ($imgtype) {
            case 
    'image/pjpeg':
            case 
    'image/jpeg':
            case 
    'image/jpg':
                
    $source imagecreatefromjpeg($source_image);
                break;
            case 
    'image/gif':
                
    $source imagecreatefromgif($source_image);
                break;
            case 
    'image/png':
            case 
    'image/x-png':
                
    $source imagecreatefrompng($source_image);
                break;
            default:
                die(
    'Invalid image type.');
        }

        
    #Figure out the dimensions of the image and the dimensions of the desired thumbnail
        
    $src_w imagesx($source);
        
    $src_h imagesy($source);


        
    #Do some math to figure out which way we'll need to crop the image
        #to get it proportional to the new size, then crop or adjust as needed

        
    $x_ratio $tn_w $src_w;
        
    $y_ratio $tn_h $src_h;

        if ((
    $src_w <= $tn_w) && ($src_h <= $tn_h)) {
            
    $new_w $src_w;
            
    $new_h $src_h;
        } elseif ((
    $x_ratio $src_h) < $tn_h) {
            
    $new_h ceil($x_ratio $src_h);
            
    $new_w $tn_w;
        } else {
            
    $new_w ceil($y_ratio $src_w);
            
    $new_h $tn_h;
        }

        
    $newpic imagecreatetruecolor(round($new_w), round($new_h));
        
    imagecopyresampled($newpic$source0000$new_w$new_h$src_w$src_h);
        
    $final imagecreatetruecolor($tn_w$tn_h);
        
    $backgroundColor imagecolorallocate($final255255255);
        
    imagefill($final00$backgroundColor);
        
    //imagecopyresampled($final, $newpic, 0, 0, ($x_mid - ($tn_w / 2)), ($y_mid - ($tn_h / 2)), $tn_w, $tn_h, $tn_w, $tn_h);
        
    imagecopy($final$newpic, (($tn_w $new_w)/ 2), (($tn_h $new_h) / 2), 00$new_w$new_h);

        
    #if we need to add a watermark
        
    if ($wmsource) {
            
    #find out what type of image the watermark is
            
    $info    getimagesize($wmsource);
            
    $imgtype image_type_to_mime_type($info[2]);

            
    #assuming the mime type is correct
            
    switch ($imgtype) {
                case 
    'image/pjpeg':
                case 
    'image/jpeg':
                case 
    'image/jpg':
                    
    $watermark imagecreatefromjpeg($wmsource);
                    break;
                case 
    'image/gif':
                    
    $watermark imagecreatefromgif($wmsource);
                    break;
                case 
    'image/png':
                case 
    'image/x-png':
                    
    $watermark imagecreatefrompng($wmsource);
                    break;
                default:
                    die(
    'Invalid watermark type.');
            }

            
    #if we're adding a watermark, figure out the size of the watermark
            #and then place the watermark image on the bottom right of the image
            
    $wm_w imagesx($watermark);
            
    $wm_h imagesy($watermark);
            
    imagecopy($final$watermark$tn_w $wm_w$tn_h $wm_h00$tn_w$tn_h);

        }
        if (
    imagejpeg($final$finished$quality)) {
       
            
    imagedestroy($final);
            
    unlink($source_image);
            return 
    true;
        }
        return 
    false;
    }
    now look down the page for this
    PHP:
                    // Copy files
                    
    foreach ($UPLOADED_PICTURES as $k => $v)
                    {
                        
    $system->move_file(UPLOAD_PATH session_id() . '/' $vUPLOAD_PATH $auction_id '/' $v);
                        
    chmod(UPLOAD_PATH $auction_id '/' $v0777);
                    }
    Replace with this
    PHP:
                // Copy files
                
    foreach ($UPLOADED_PICTURES as $k => $v)
                {
                    
    $source=(UPLOAD_PATH session_id() . '/' $v);
                    
    $destination=(UPLOAD_PATH $auction_id '/' $v);
                    
    resize($source$destination1024768);
                    
    chmod(UPLOAD_PATH $auction_id '/' $v0777);
                    } 
    now on the function call, in this part you can change the image dimension . i have mine set to 1024px width by 768px height. You can change these numbers to suit your setup.

    now save file and go test and see if it works for you ;)

    ps: dont forget to change your fixed height rules in css

    Thanks to Stackoverflow and Automatic Image Resizer for helping me to get this working :) i dont know how to code but looking over yours helped sort this problem Cheers

    All The Best
    BabyDunk
     
    Last edited by a moderator: Mar 10, 2017
  18. Giuseppe

    Giuseppe New Member

    Joined:
    Aug 24, 2019
    Messages:
    4
    Likes Received:
    0
    What i should change in css? I try this method but it seems to doesn't work..
     

Share This Page