Log in | Register | Lost password

Bottom
Better(?) insert image function
  • Posted: 29.07.2004, 10:43
     
    Converted
    rank:
    12
    registered:
     March 2009
    Status:
    offline
    last visit:
    Posts:
    0
    Im working on postnuke port of a site, and wanted a repository for all the images on the site (well, except design). I found Photoshare to be the closest match, but I wasn't really happy with the image selector (I guess it would do for internal purposes, but we have a lot of users who can edit/add stuff). So I made this hack in pnuser.php:

    [php]
    /**
    * Select image hack
    *
    * @author Erlend Halvorsen
    * @return boolean
    **/
    function photoshare_user_selectimage( $args ) {
    $imageId = pnVarCleanFromInput( 'iid' );
    extract( $args );

    echo '';

    return true;
    }

    function photoshareGetImageMenu($folderID)
    {
    $imageDir = 'modules/' . photoshareModGetName() . '/pnimages';
    $menu = array( array( 'title' => _PSVIEWIMAGE, 'image' => 'magnify.gif' ),
    array( 'title' => _PSEDITIMAGE, 'image' => 'setting.gif' ),
    array( 'title' => _PSDELETEIMAGE, 'image' => 'delete.gif' ),
    array( 'title' => _PSROTATECIMAGE, 'image' => 'rotatec.gif' ),
    array( 'title' => _PSROTATECCIMAGE, 'image' => 'rotatecc.gif' ),
    array( 'title' => _PSSETMAINIMAGE, 'image' => 'greendot.gif' ) );

    // Menu HTML setup
    $menuHTML = "
    \n"
    . "\n";

    // One table row for each menu item
    foreach ($menu as $menuItem)
    $menuHTML .= "\n"
    . ""
    . "\n"
    . "\n";

    // select image hack
    $menuHTML .= '';

    // End menu HTML
    $menuHTML .= "
    " .( $menuItem['image'] ? "" : "" ) . "$menuItem[title]
    \n"
    . "
    \n";

    // Add URL for click action
    $viewURL = pnModUrl('photoshare', 'user', 'showimages', array('fid' => $folderID, 'template' => 'slideshow'));
    $editURL = pnModUrl('photoshare', 'user', 'editimage', array('fid' => $folderID));
    $deleteURL = pnModUrl('photoshare', 'user', 'deleteimage', array('fid' => $folderID));
    $rotatecURL = pnModUrl('photoshare', 'user', 'rotateimage', array('fid' => $folderID, 'dir' => 'c'));
    $rotateccURL = pnModUrl('photoshare', 'user', 'rotateimage', array('fid' => $folderID, 'dir' => 'cc'));
    $setMainURL = pnModUrl('photoshare', 'user', 'setmainimage', array('fid' => $folderID));

    // select image hack
    $selectImageURL = pnModUrl( 'photoshare', 'user', 'selectimage' );

    $menuHTML .= "\n";

    return $menuHTML;
    }
    [/php]

    All changes are marked "select image hack".

    http://www.avrfreaks.net/~ehalvorsen/insert.gif


    Note: it seems the [php] funciton fucks up the markup. < and so on should of course be <, etc. Also, when I had the image before the code, the image disappeared, along with half my code. Time to change to PNphpBB? ;)

    -Erlend
  • Posted: 16.08.2004, 00:45
     
    Converted
    rank:
    12
    registered:
     March 2009
    Status:
    offline
    last visit:
    Posts:
    0
    Has anyone else tried this? I must be honest and say that I don't get the point here... How are you using this? The image is very confusing (and BIG! ;) ).

Template courtesy of Designs By Darren.