Cropping a referenced image
Sannyasin Brahmanathaswami
brahma at hindu.org
Tue Aug 14 15:18:39 EDT 2018
Klaus! Brilliant! and "too easy" to boot
on mouseup
put "https://i.ytimg.com/vi/KO3l3-4pFyo/default.jpg"<https://i.ytimg.com/vi/KO3l3-4pFyo/default.jpg> into tURL
set the itemdel to "/"; put item -2 of tURL into tImageName
clone img "ytBtnIconTemplate" as tImageName
put the long id of img tImageName into pImage
set the filename of pImage to "https://i.ytimg.com/vi/KO3l3-4pFyo/default.jpg"<https://i.ytimg.com/vi/KO3l3-4pFyo/default.jpg>
set the icon of button "ytTubeThumb" to (the id of pImage)
end mouseup
# Now, we now we have the reference image (hidden on a card)
# so we don't have go to web to get them if they scroll "around" to the card again
on mouseup
put "https://i.ytimg.com/vi/KO3l3-4pFyo/default.jpg"<https://i.ytimg.com/vi/KO3l3-4pFyo/default.jpg> into tURL
set the itemdel to "/"; put item -2 of tURL into tImageName
clone img "ytBtnIconTemplate" as tImageName
put the long id of img tImageName into pImage
if exists(pImage) = false then
set the filename of pImage to "https://i.ytimg.com/vi/KO3l3-4pFyo/default.jpg"<https://i.ytimg.com/vi/KO3l3-4pFyo/default.jpg>
end if
set the icon of button "ytTubeThumb" to (the id of pImage)
end mouseup
C'est merveilleux!
@ steve, i have used the copy,crop & exportscreen shot method on a puzzle where we need to take the words in a field and copy to "tiles" but there is a hit of the CPU that we can afford in mobile.
BR
On 8/14/18 5:05 AM, Klaus major-k via use-livecode wrote:
can't you use a button, set its icon to your image(s) and then just "crop" the button?
Know what I mean?
...
set the width of btn "el croppo" to the width of img pImage
## Or use formattedwidth...
set the height of btn "el croppo" to round(the width of img pImage/16*9)
...
More information about the use-livecode
mailing list