JPGs, etc in bBrowser - Clipper

This is a discussion on JPGs, etc in bBrowser - Clipper ; Hello All, Is someone willing to share how to load JPGs in a bBrowser? TIA, Michael...

+ Reply to Thread
Results 1 to 6 of 6

JPGs, etc in bBrowser

  1. Default JPGs, etc in bBrowser

    Hello All,

    Is someone willing to share how to load JPGs in a bBrowser?

    TIA,

    Michael


  2. Default Re: JPGs, etc in bBrowser

    Hello Michael,
    > Is someone willing to share how to load JPGs in a bBrowser?

    Run the bSample - Images (import from you bBrowser\Samples directory)
    - it's all there.

    HTH,

    Marcos Nogueira
    S. Paulo - Brazil


  3. Default Re: JPGs, etc in bBrowser

    Marcos, thanks for the reply. When I looked at that sample, it seemed
    that it only worked for bitmaps. Am I missing something?

    Michael

    Marcos Nogueira wrote:
    > Hello Michael,
    > > Is someone willing to share how to load JPGs in a bBrowser?

    > Run the bSample - Images (import from you bBrowser\Samples directory)
    > - it's all there.
    >
    > HTH,
    >
    > Marcos Nogueira
    > S. Paulo - Brazil



  4. Default Re: JPGs, etc in bBrowser

    Michal,
    Some code,
    In some bbrowser i show or hide a column of thumbnails depending of
    the user choice,
    look the method ShowThumbnails().

    I hope this help you.

    Paulo Oliveira

    METHOD GetImage(oServer) CLASS DWAmostras

    // this method creates, for the current recno of the server, a
    thumbnail image
    // on disk and returns this to the bBrowser.
    // once the thumbnail exists, it will next time be returned
    instead of created;
    // We save the thumbnails in a temp folder, and give them a
    name whcih is the RECNO+".JPG"
    // (the recno is unique for this DBF. This technique will not
    work O.K if you want to
    // display images in several browsers with diffrent DBF's
    linked to them!
    // IN that case you'll have to generate a more unique name!

    LOCAL oReturnImage AS bBitmap
    LOCAL oFabImage AS USUAL
    LOCAL cFileName,cCaminho,cNome AS STRING
    LOCAL nHeight,nWidth AS LONG
    LOCAL nMaxDim,r8Scalefactor,nNewHeight, nNewWidth AS REAL8

    cCaminho:=POGetAppObject():cImg_Path+"\AMOSTRAS"

    IF File(AllTrim(cCaminho)+"\"+AllTrim(oServer:cImagem)) //if
    thumbnail already there; just take this one
    cFileName := AllTrim(AllTrim(cCaminho)
    +"\"+AllTrim(oServer:cImagem))
    oFabImage := FabPaintLib{cFileName, SELF}
    nHeight := oFabImage:Height
    nWidth := oFabImage:Width
    nMaxDim := Max(nHeight, nWidth) // determine bigest
    dimension
    // determine scalefactor in relation to 100 pixels
    (because we want to resize to 100 pixels)
    r8Scalefactor := 50/nMaxDim
    nNewHeight := nHeight*r8Scalefactor
    nNewWidth := nWidth*r8Scalefactor
    oFabImage:ResizeBilinear(nNewWidth, nNewHeight)//
    transform to 32 bpp
    oReturnImage := bBItmap{oFabImage:Handle(),} //
    create Image object and pass handle
    ELSE
    oFabImage := FabPaintLib{}
    oFabImage:CreateFromResourceName(_GetInst(),"SEM_IMAGEM")

    nHeight := oFabImage:Height
    nWidth := oFabImage:Width
    nMaxDim := Max(nHeight, nWidth) // determine bigest
    dimension
    // determine scalefactor in relation to 100 pixels
    (because we want to resize to 100 pixels)
    r8Scalefactor := 50/nMaxDim
    nNewHeight := nHeight*r8Scalefactor
    nNewWidth := nWidth*r8Scalefactor
    oFabImage:ResizeBilinear(nNewWidth, nNewHeight)//
    transform to 32 bpp
    oReturnImage := bBItmap{oFabImage:Handle(),} // create
    Image object and pass handle

    ENDIF

    RETURN oReturnImage



    METHOD ShowThumbnails() CLASS DWAmostras

    LOCAL oColumn AS bDataColumn

    // thumbnails on
    IF SELF:lVeImagens
    SELFDCbBDetalheBase:EnableRowHeightVariable(TRUE)
    SELFDCbBDetalheBase:RowHeightMax := 50
    SELFDCbBDetalheBase:RowHeight:=50

    // initialize virtual column IMAGE

    SELFointer := Pointer{POINTERHOURGLASS}
    oColumn := bDataColumn{SELFDCbBDetalheBase,; // owner of the
    column
    SELFDCbBDetalheBase:Server,; // server where
    to check expression
    {|Server, arg| arg:GetImage(Server)},; //
    uExpression
    #Expression,; // symFieldmode
    SELF} // argument --> SELF:GetImage()
    oColumn:Caption := "FOTO"
    oColumn:Hyperlabel := Hyperlabel{#FOTO}
    oColumn:ValType := "O" // type is an Object! (image)
    oColumn:Alignment := BALIGN_CENTER
    oColumn:Width := 50 // make column 100 pixels wide
    oColumn:Resizable := FALSE

    SELFDCbBDetalheBase:SuspendNotification()
    SELFDCbBDetalheBase:AddCOlumn(oColumn)
    IF SELF:lMostraSel
    SELFDCbBDetalheBase:OpenColumn(oColumn,2) //
    Segunda coluna
    ELSE
    SELFDCbBDetalheBase:OpenColumn(oColumn,1) // Primeira coluna
    ENDIF

    SELFDCbBDetalheBase:Recalculate()
    SELFDCbBDetalheBase:Refresh()
    SELFointer := Pointer{POINTERARROW}
    SELFDCbBDetalheBase:ResetNotification()
    SELFDCbBDetalheBase:SetFocus()


    ELSE
    oColumn := SELFDCbBDetalheBase:GetColumn(#FOTO)
    IF oColumn <> NULL_OBJECT
    SELFDCbBDetalheBase:RemoveColumn(oColumn,FALSE)
    SELFDCbBDetalheBase:EnableRowHeightVariable(FALSE)

    SELFDCbBDetalheBase:Rowheight :=SELF:dOrigRowHeight // reset
    rowheight to original one
    SELFDCbBDetalheBase:Recalculate()
    SELFDCbBDetalheBase:Refresh()

    SELFDCbBDetalheBase:Recalculate()
    SELFDCbBDetalheBase:SetFocus()
    ENDIF
    ENDIF
    RETURN NIL




  5. Default Re: JPGs, etc in bBrowser

    Hello Michael,
    > Marcos, thanks for the reply. When I looked at that sample, it seemed
    > that it only worked for bitmaps. Am I missing something?


    Follows part of my code to display any type of image in bBrowser.
    Please note that the image is saved on disk, not in a field:

    [...]
    FUNCTION ShowImage( cFile, nScale )

    LOCAL oReturnImage AS bBitmap // bBitmap from bBrowser sample
    LOCAL oImage AS FabPaintLib // graph lib from Fabrice Foray
    LOCAL nHeight, nWidth AS LONG
    LOCAL nNewHeight, nNewWidth AS REAL8

    Default( @cFile, "" )
    Default( @nScale, 1 )

    IF File( cFile )
    oImage := FabPaintLib{ cFile }
    nHeight := oImage:Height
    nWidth := oImage:Width
    nNewHeight := nHeight/nScale
    nNewWidth := nWidth/nScale
    oImage:ResizeBilinear( nNewWidth, nNewHeight )
    oReturnImage := bBitmap{ oImage:Handle(), }
    ELSE
    oImage := FabPaintLib{}
    oImage:CreateFromResourceName( _GetInst(),"NO_IMAGE" )
    oReturnImage := bBitmap{ oFabImage:Handle(), }
    ENDIF

    RETURN oReturnImage
    [...]

    HTH,

    Marcos


  6. Default Re: JPGs, etc in bBrowser

    Many thanks to both Paulo and Marcos.

    Michael





    On Jul 6, 10:32 am, Marcos Nogueira <marcos.nogue...@ig.com.br> wrote:
    > Hello Michael,
    >
    > > Marcos, thanks for the reply. When I looked at that sample, it seemed
    > > that it only worked for bitmaps. Am I missing something?

    >
    > Follows part of my code to display any type of image in bBrowser.
    > Please note that the image is saved on disk, not in a field:
    >
    > [...]
    > FUNCTION ShowImage( cFile, nScale )
    >
    > LOCAL oReturnImage AS bBitmap // bBitmap from bBrowser sample
    > LOCAL oImage AS FabPaintLib // graph lib from Fabrice Foray
    > LOCAL nHeight, nWidth AS LONG
    > LOCAL nNewHeight, nNewWidth AS REAL8
    >
    > Default( @cFile, "" )
    > Default( @nScale, 1 )
    >
    > IF File( cFile )
    > oImage := FabPaintLib{ cFile }
    > nHeight := oImage:Height
    > nWidth := oImage:Width
    > nNewHeight := nHeight/nScale
    > nNewWidth := nWidth/nScale
    > oImage:ResizeBilinear( nNewWidth, nNewHeight )
    > oReturnImage := bBitmap{ oImage:Handle(), }
    > ELSE
    > oImage := FabPaintLib{}
    > oImage:CreateFromResourceName( _GetInst(),"NO_IMAGE" )
    > oReturnImage := bBitmap{ oFabImage:Handle(), }
    > ENDIF
    >
    > RETURN oReturnImage
    > [...]
    >
    > HTH,
    >
    > Marcos




+ Reply to Thread

Similar Threads

  1. resizing jpgs in photoshop elements 5.0
    By Application Development in forum Adobe Photoshop
    Replies: 1
    Last Post: 09-27-2007, 03:59 PM
  2. Problemas con bBrowser cellclick y bBrowser celldoubleclick
    By Application Development in forum Clipper
    Replies: 11
    Last Post: 07-26-2007, 12:51 AM
  3. Dark JPGs (one of two problems)
    By Application Development in forum Adobe Framemaker
    Replies: 3
    Last Post: 02-05-2007, 05:21 PM
  4. resizing 40MB+ JPGs
    By Application Development in forum Graphics
    Replies: 1
    Last Post: 01-22-2005, 02:55 PM
  5. Loading JPGs on a web page
    By Application Development in forum Graphics
    Replies: 1
    Last Post: 08-24-2004, 10:24 PM