Auto resizing of images on upload

Discussion in 'Mod Archive' started by tmongy, Apr 1, 2010.

  1. Guest

    Guest Guest

  2. phasar

    phasar New Member

    Joined:
    Jul 20, 2011
    Messages:
    78
    Likes Received:
    10
    I get an error when i click on your simple gallery mod

    phasar, you do not have permission to access this page. This could be due to one of several reasons:
    etc. etc. etc.
     
  3. panicmi

    panicmi New Member

    Joined:
    Nov 16, 2012
    Messages:
    1
    Likes Received:
    0
    HELLO
    I am new on webid i need this Auto resizing of images on upload.
    can you help me
    thanks
     
  4. nay27uk

    nay27uk Super Moderator Staff Member

    Joined:
    Nov 24, 2009
    Messages:
    5,572
    Likes Received:
    546
    Follow the instructions above and install it
     
  5. reivis

    reivis New Member

    Joined:
    Oct 29, 2012
    Messages:
    9
    Likes Received:
    0
    Great mod!
    But does it work for 1.0.4?
    I installed it and my uploadgallery does'nt work any more.
    When I click om upload I see no picture ony a red cross!
     
  6. fleskesidol

    fleskesidol Member

    Joined:
    Nov 7, 2011
    Messages:
    43
    Likes Received:
    0
    This is a really good job, thousand of thanks
     
  7. h123456

    h123456 New Member

    Joined:
    Jun 8, 2013
    Messages:
    7
    Likes Received:
    0
    i use webid1.1 i want reduce image size
    But whatever, I'm changing the code does not have any effect
    i add SimpleImage class to upldgallery.php
     
  8. AnthonyL123

    AnthonyL123 New Member

    Joined:
    Jul 6, 2013
    Messages:
    39
    Likes Received:
    2
    Will this work with the new version 1.1? Thanks.
     
  9. fleskesidol

    fleskesidol Member

    Joined:
    Nov 7, 2011
    Messages:
    43
    Likes Received:
    0
    Hello,
    I try it for the moment and (it is not) I can't make it working with the new file *upldgallery.php*

    It is everytime possible to upload pictures and if the resizing was marchin to the version 1.0.6 it is no more working with the 1.1.0.

    Probably I don't understand something, back to the version 1.0.6 and it's working quiet fine !

    By
     
    Last edited: Aug 14, 2013
  10. Juhanuha

    Juhanuha New Member

    Joined:
    Aug 18, 2013
    Messages:
    9
    Likes Received:
    0
    Has anyone got this to work in 1.10?
     
  11. micco

    micco New Member

    Joined:
    Sep 10, 2013
    Messages:
    9
    Likes Received:
    1
    Dont work on 1.1.0

    I dont think it will work on 1.1.0 because the upldgallery.php file is very different from earlier fil, and it seems like that there allready is added an image-sizer in it :

    // PROCESS UPLOADED FILE
    if (isset($_POST['uploadpicture']) && $_POST['uploadpicture'] == $MSG['681'])
    {
    if (!empty($_FILES['userfile']['tmp_name']) && $_FILES['userfile']['tmp_name'] != 'none')
    {
    if (!isset($_SESSION['UPLOADED_PICTURES']) || !is_array($_SESSION['UPLOADED_PICTURES'])) $_SESSION['UPLOADED_PICTURES'] = array();
    if (!isset($_SESSION['UPLOADED_PICTURES_SIZE']) || !is_array($_SESSION['UPLOADED_PICTURES_SIZE'])) $_SESSION['UPLOADED_PICTURES_SIZE'] = array();
    $filename = $_FILES['userfile']['name'];
    $nameparts = explode('.', $filename);
    $ext_key = count($nameparts) - 1;
    $file_ext = strtolower($nameparts[$ext_key]);
    $file_types = array('gif', 'jpg', 'jpeg', 'png');

    // clean the name
    unset($nameparts[$ext_key]);
    $newname = implode('_', $nameparts);

    $newname = preg_replace('/[^a-zA-Z0-9_]/', '', $newname);
    $newname .= '.' . $file_ext;

    if ($_FILES['userfile']['size'] > $system->SETTINGS['maxuploadsize'])
    {
    $ERR = $ERR_709 . ' ' . ($system->SETTINGS['maxuploadsize'] / 1024) . ' ' . $MSG['672'];
    }
    elseif (!in_array($file_ext, $file_types))
    {
    $ERR = $ERR_710 . ' (' . $file_ext . ')';
    }
    elseif (in_array($newname, $_SESSION['UPLOADED_PICTURES']))
    {
    $ERR = $MSG['2__0054'] . ' (' . $_FILES['userfile']['name'] . ')';
    }
    else
    {
    // Create a TMP directory for this session (if not already created)
    if (!file_exists($upload_path . session_id()))
    {
    umask(0);
    mkdir($upload_path . session_id(), 0777);
    chmod($upload_path . session_id(), 0777); //incase mkdir fails
    }
    // Move uploaded file into TMP directory & rename
    if ($system->move_file($_FILES['userfile']['tmp_name'], $upload_path . session_id() . '/' . $newname))
    {
    // Populate arrays
    array_push($_SESSION['UPLOADED_PICTURES'], $newname);
    $fname = $upload_path . session_id() . '/' . $newname;
    array_push($_SESSION['UPLOADED_PICTURES_SIZE'], filesize($fname));
    if (count($_SESSION['UPLOADED_PICTURES']) == 1)
    {
    $cropdefault = true;
    $image = $newname;
    }
    }
    }
    }
    }

    if ($cropdefault)
    {
    list($imgwidth, $imgheight) = getimagesize($upload_path . session_id() . '/' . $image);
    $swidth = ($imgwidth < 380) ? '' : ' width: 380px;';
    $imgratio = ($imgwidth > 380) ? $imgwidth / 380 : 1;
    $whratio = $imgheight / $imgwidth;
    if ($imgwidth > $imgheight) //landscape
    {
    $ratio = '1.2:1';
    $thumbwh = 'width:' . $width . '; height:' . $height . ';';
    $scaleX = 120;
    $scaleY = 100;
    $startY = 380 * $whratio;
    $startX = $startY * 1.2;
    }
    else //portrait
    {
    $ratio = '1:1.2';
    $thumbwh = 'height:' . $width . '; width:' . $height . ';';
    $scaleX = 100;
    $scaleY = 120;
    $startX = 380 * $whratio;
    $startY = $startX * 1.2;
    }

    $template->assign_vars(array(
    'RATIO' => $ratio,
    'THUMBWH' => $thumbwh,
    'SCALEX' => $scaleX,
    'SCALEY' => $scaleY,
    'IMGRATIO' => $imgratio,
    'SWIDTH' => $swidth,
    'IMGWIDTH' => $imgwidth,
    'IMGHEIGHT' => $imgheight,
    'IMGPATH' => $uploaded_path . session_id() . '/' . $image,
    'STARTX' => $startX,
    'STARTY' => $startY,
    'IMAGE' => $image
    ));
    }
    else
    {
    $template->assign_vars(array(
    'MAXIMAGES' => $system->SETTINGS['maxpictures'],
    'ERROR' => (isset($ERR)) ? $ERR : '',

    'B_CANUPLOAD' => (!isset($_SESSION['UPLOADED_PICTURES']) || count($_SESSION['UPLOADED_PICTURES']) < $system->SETTINGS['maxpictures'])
    ));
    }

    // built gallery
    foreach ($_SESSION['UPLOADED_PICTURES'] as $k => $v)
    {
    $template->assign_block_vars('images', array(
    'IMGNAME' => $v,
    'ID' => $k,
    'DEFAULT' => ($v == $_SESSION['SELL_pict_url_temp']) ? 'selected.gif' : 'unselected.gif',
    'IMAGE' => $uploaded_path . session_id() . '/' . $v
    ));
    }

    if ($system->SETTINGS['fees'] == 'y')
    {
    $query = "SELECT value FROM " . $DBPrefix . "fees WHERE type = 'picture_fee'";
    $res = mysql_query($query);
    $system->check_mysql($res, $query, __LINE__, __FILE__);
    $image_fee = mysql_result($res, 0);
    }
    else
    {
    $image_fee = 0;
    }

    // get decimals for javascript rounder
    $decimals = '';
    for ($i = 0; $i < $system->SETTINGS['moneydecimals']; $i++)
    {
    $decimals .= 0;
    }

    $template->assign_vars(array(
    'SITENAME' => $system->SETTINGS['sitename'],
    'THEME' => $system->SETTINGS['theme'],
    'ERROR' => (isset($ERR)) ? $ERR : '',
    'IMAGE_COST' => ($image_fee != 0) ? sprintf($MSG['675'], $image_fee) : '',
    'IMAGE_COST_PLAIN' => ($image_fee != 0) ? $image_fee : 0,
    'PICINFO' => sprintf($MSG['673'], $system->SETTINGS['maxpictures'], $system->SETTINGS['maxuploadsize']),
    'ERRORMSG' => sprintf($MSG['674'], $system->SETTINGS['maxpictures']),
    'MAXPICS' => $system->SETTINGS['maxpictures'],
    'MAXPICSIZE' => $system->SETTINGS['maxuploadsize'],
    'SESSION_ID' => session_id(),
    'UPLOADED' => intval(count($_SESSION['UPLOADED_PICTURES']))
    ));
    $template->set_filenames(array(
    'body' => 'upldgallery.tpl'
    ));
    $template->display('body');
    ?>


    Maybe Dahls varehus knows more about it ?
     
  12. fnap

    fnap New Member

    Joined:
    Nov 17, 2013
    Messages:
    2
    Likes Received:
    1
    hi, i' m using webid 1.1 , really i searched in this forum but i didn't find any way for resizing image gallery for version 1.1, i used the auto resizing image mode but it's not work, any way for this problem?
     
  13. gomezm0232

    gomezm0232 New Member

    Joined:
    Jun 20, 2014
    Messages:
    3
    Likes Received:
    4
  14. gomezm0232

    gomezm0232 New Member

    Joined:
    Jun 20, 2014
    Messages:
    3
    Likes Received:
    4
  15. sprokkel

    sprokkel Active Member

    Joined:
    Apr 1, 2013
    Messages:
    162
    Likes Received:
    7
    Auto resizing of images on upload
    I' use webid 1.1.2P2
    upldgallery.php , cant find this to change it include 'includes/common.inc.php';
     
  16. pani100

    pani100 Well-Known Member

    Joined:
    May 9, 2011
    Messages:
    2,327
    Likes Received:
    449
    Hi sprokkel,
    on the newer versions
    include 'includes/common.inc.php';
    has been replaced with
    include 'common.php';
     
  17. sprokkel

    sprokkel Active Member

    Joined:
    Apr 1, 2013
    Messages:
    162
    Likes Received:
    7
    Last edited: Jun 5, 2015

Share This Page