Sign in to follow this  
Followers 0
byarotsky

Problem building multi thumbnail display screen

4 posts in this topic

#1 ·  Posted (edited)

I am attempting to build a script that will pull jpg files from my external device, copy local, resize and change orientation and move to the server is serveral places. Part of the script I would like to have a preview screen to check off the files that I want to process. I have taken some examples and tried to manipulate to do what I want, but I am struggling to get my list of images to show properly.

Basically in this test I would like to read list of files from folder

Generate a screen with thumbnails and a corresponding checkbox

Each thumbnail will show a different file in the folder

Currently I am only able to show either the last image in the first location and the rest are blank or all images are the same picture. Also I haven't even tried getting more than one line of images (fill the screen).

Any help would be greatly appreciated.

Thanks

Brad

#include <GDIPlus.au3>
#include <Array.au3>
#include <File.au3>
Global $ImgPath = "C:Documents and SettingsOwnerDesktopTest2"
Local $hGui, $iPic, $hGraphic, $hBitmap, $hImage

$hGui = GUICreate("", @DesktopWidth, @DesktopHeight)
$iPic = GUICtrlCreatePic("", 0, 25, @DesktopWidth, 25)
$ImgHeight = 133
$ImgWidth = 133
$ImgSpacing = 10

Local $localfile = _FileListToArray($ImgPath, "*.jpg", 1) ; List all jpg files in last folder
_ArrayDelete($localfile, 0)
_ArraySort($localfile)
;_ArrayDisplay($localfile)

_GDIPlus_Startup()
$hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGui)
$hBitmap = _GDIPlus_BitmapCreateFromGraphics(@DesktopWidth, $ImgHeight, $hGraphic)
_GDIPlus_GraphicsDispose($hGraphic)
$hGraphic = _GDIPlus_ImageGetGraphicsContext ($hBitmap)
While UBound($localfile)
$PopFileName = _ArrayPop($localfile)
For $i = 0 To @DesktopWidth - $ImgWidth Step $ImgWidth + $ImgSpacing
$hImage = _GDIPlus_ImageLoadFromFile ($ImgPath & $PopFileName)
_GDIPlus_GraphicsDrawImageRect($hGraphic, $hImage, $i + $ImgSpacing , 0, $ImgWidth, $ImgHeight)
GUICtrlCreateCheckbox($PopFileName, $i + $ImgSpacing , $ImgHeight + 25, 120, 20)
_GDIPlus_GraphicsDispose($hGraphic)
_GDIPlus_ImageDispose($hImage)
Next
WEnd

$hImage = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBitmap)
_GDIPlus_BitmapDispose($hBitmap)
_WinAPI_DeleteObject(GUICtrlSendMsg($iPic, 0x0172, 0, $hImage))
_GDIPlus_ShutDown()

GUISetState(@SW_SHOW, $hGui)

While GUIGetMsg() <> -3
WEnd
Edited by byarotsky

Share this post


Link to post
Share on other sites



Sorry, I have corrected the posted code. Can anyone shed any light on this?

Thanks

Brad

Share this post


Link to post
Share on other sites

This might help you ->

Br,

UEZ


Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites

Thank you. This is looking very close to what I am looking for. I will pick it apart later this week.

Brad

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0