Saving content of image box
Posted: Sun Nov 30, 2014 4:46 pm
Have been getting really frustrated with LiveCode this weekend
I'm writing a program to resize an image to 150 x 150. I've finally got the selected image to show up in an Image control (imgNewLogo) in the correct size.
Now trying to save that as a new image.
The code for my file save button is
Using the "put image" line just makes an empty file, and the "export image" lines cause Livecode to crash with no explanation.
The value in field "fldNewName" is "/home/brian/Pictures/new_mario.png" (as an example), could someone tell me where I'm going wrong?
Thanks in advance

I'm writing a program to resize an image to 150 x 150. I've finally got the selected image to show up in an Image control (imgNewLogo) in the correct size.
Now trying to save that as a new image.
The code for my file save button is
Code: Select all
on mouseUp
local pNewName,file_ext
set the itemdelimiter to "."
put the text of field "fldNewName" into pNewName
#put toupper(item -1 of pNewName) into file_ext
#if file_ext="PNG" then
#export image "imgNewLogo" to file pNewName as PNG
#else if (file_ext="JPG" or file_ext="JPEG") then
#export image "imgNewLogo" to file pNewName as JPEG
#end if
put image "imgNewLogo" into url ("binfile:" & pNewName)
end mouseUp
The value in field "fldNewName" is "/home/brian/Pictures/new_mario.png" (as an example), could someone tell me where I'm going wrong?
Thanks in advance