Image Source Issue: Grouped Controls and Image Source Reference was changed - problem for iOS App

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
booee
Posts: 41
Joined: Fri Mar 27, 2015 9:48 pm

Image Source Issue: Grouped Controls and Image Source Reference was changed - problem for iOS App

Post by booee » Fri Nov 22, 2019 2:54 pm

So I notice some of my image sources show (SHORTENED SOURCE URL):
images/imageDOTpng

And others show (LONG SOURCE URL):
/Users/mycomputername/Documents/LiveCode App/myimageDOTpng

I figured out the bottom issue took place when I "group controls" together, I believe it changed the IMG SRC to the long version.
The issue is that if I create an iOS app, and put my application on an iPad...None of the images that have the LONG source show up on the App.
The bigger issue is that manually changing all of the images isn't really a possibility. It would be thousands of manual changes.

Any idea of how to deal with this?

Thanks!

Klaus
Posts: 14193
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Image Source Issue: Grouped Controls and Image Source Reference was changed - problem for iOS App

Post by Klaus » Fri Nov 22, 2019 6:05 pm

Hi booee,

yes, this is a known problem when using absolute pathnames.
So your stack with the images is in this folder:
/Users/mycomputername/Documents/LiveCode App/
?
And ALL of your images are in that folder resp. in a subfolder named "images" inside of that folder?

Then you can use a little script to remove the ABSOLUTE part of the filenames.
Like this, out of my head, so better try this with a copy of your stack!
Create a button in your stack, you can later delete it, with this script:

Code: Select all

on mouseUp 
   
   ## We loop though all cards...
   put the num of cds of this stack into tNumberOfCards
   repeat with i = 1 to tNumberOfCards
      put the num of images of cd i into tNumberOfImages
      
      ## ...and through all images on each card
      repeat with k = 1 to tNumberOfImages
         put the filename of img k of cd i into tFileName
         
         ## Remove the absolute part from the filename, so the RELATIVE path remains
         replace "/Users/mycomputername/Documents/LiveCode App/" with EMPTY in tFileName
         ## If that "string" is NOT in the fielname, nothing will happen
         ## Means all images with NO abolute pathname will not be touched!
         
         ## Set filename again, but now with the relative pathname
         set the filename of img k of cd i to tFileName         
      end repeat
   end repeat
end mouseUp
Best

Klaus

booee
Posts: 41
Joined: Fri Mar 27, 2015 9:48 pm

Re: Image Source Issue: Grouped Controls and Image Source Reference was changed - problem for iOS App

Post by booee » Fri Nov 22, 2019 7:18 pm

Oh wow, this is amazing. Yup, all of my images are in that folder.

Thank you so much for your help!

Post Reply