Referencing images in code

I have a project to which I added two images. The images are called image1.jpg and image2.jpg. I have an ImageView object in the interface which allows me to use one of said images to show. This is great. I have a button that shows the other image when clicked. Then, if you click it again, it shows the original image again. How do I reference images that are in the project resources section without providing a full path? For example, the only way I could get it to work is /Users/myUser/Documents/MyApp/image2.jpg. Of course when this app is distributed, the image won't be in that same location (unless for some reason everyone on earth uses my same username). I tried just using the image filename image2.jpg but that doesn't work, the image doesn't load properly. Thanks in advance!

Thanks. In this case, I had two images image1.jpg and image2.jpg already in my project. Getting the path to them was as easy as this:
NSBundle *mainBundle = [NSBundle mainBundle];
NSString *image1Path = [mainBundle pathForImageResource:@"image1"];
NSString *image2Path = [mainBundle pathForImageResource:@"image2"];
I guess NSBundle takes care of adding the extensions.

Similar Messages

  • I am using referenced images, saved on an external hard drive. It would be most helpful to transfer the new captions (version name) to the referenced images which still have the camera code on them. How can this be done? Thanks so much!

    I am using referenced images, saved on an external hard drive. It would be most helpful to transfer the new captions (version name) to the referenced images which still have the camera code on them. How can this be done? Thanks so much!

    You're question is hard to follow. Are you looking to rename your master files to the version name? Or are you looking to do something with IPTC caption field and the masters?

  • Referencing images via proxy server

    Hi. Has anyone else run into referencing images via an IIS proxy server? I
    can use the method to get the context path, but it doesn't bring me back
    something I can use to reference images. Do I have to hard code those in
    there all the time? :< DOH!

    I solved this problem last night. I ditched IIS, redid my machine with just
    WLS on it now! :> Now I just have to figure out how to get the FTP
    functionality I lost. Any ideas?
    "PHenry" <[RemoveBeforeSending][email protected]> wrote in message
    news:[email protected]..
    Hi. Has anyone else run into referencing images via an IIS proxy server?I
    can use the method to get the context path, but it doesn't bring me back
    something I can use to reference images. Do I have to hard code those in
    there all the time? :< DOH!

  • Aperture 3.4.3: Referenced images lost in time machine restore but previews remain

    Dear Aperture Community,
    I recently purchased a new iMac and used a time machine backup of my old iMac to move my files over to the new Mac. All seemed to work well, and I have been using my new iMac happily for a couple of weeks.
    I have Aperture 3.4.3 with about 40,000 photos in my database.
    However, I just noticed that a small handful of semi-recent photos (~100) have a badge showing that "The referenced image’s master has not been found" (the yellow triangle arrow badge). I tried "Locate Reference Files" for all photos to redirect to the new hard drive name, but that failed to locate the ~100 missing images. I tried to inspect the Aperture library by Control-clicking on the Aperture library and choosing Show Package Contents - indeed the ~100 images were not there, but the ~40k other images were.
    I can imagine that this issue may or may not be due to Time Machine, but I certainly never deleted any images. I always import my photos directly into Aperture.
    How can my thumbnails and high resolution previews of the 100 images still be visible in Aperture, and yet the masters be lost?
    I'd like to recover the images. Worst case, I will use Grab to capture the previews, which are of course much lower resolution than the originals, but at least I'll have something...
    Thanks for your help!

    thanks for the reply Frank:
    Masters.  I do not know.  I left it as the default.  I assume that means managed?
    Error message was the LONG error code with the jist of it being related to what sounds like a PLUGIN error. I don't have the EXACT coding right now as I am not home.  I've googled the code +/- other stuff on it and according to discussions here and elsewhere (albeit all archived), it looks like it was related to my plugins. 
    as far as the restore is concerned, I am POSITIVE that the restored library was the NEW library not the original.  But keep in mind, Time Machine only lets me restore the backup to the exact place where the file was before.  I am just worried that somehow Time Machine backup hosed my Aperture library somewhere along the way.  This is why I was wondering if there is something else I need to restore with my time machine backup besides the library file/database itself?
    Thanks for the quick reply.

  • Referenced Images Say They are Referenced But Are Not.

    Is anyone having the following problem? I have about 4500 images that were Imported into Aperture as Referenced. Have been working with them over the past month. Tried making a Web Journal recently and after exporting the pages, many of the images did not show up in the web pages although the caption did. I went back to my Album and went through the images. The ones that didn't show up in the web pages were very strange looking within the Album. As a thumbnail they looked fine but when I put the loupe on them at 100% it was obvious that they were some sort of small jpeg or something due to lots of jaggies and poor quality. Even though the Reference icon was supposedly fine, telling me it was online since it did not have a yellow warning label, for some reason Aperture was not accessing the original RAW file.
    I now have hundreds of images I have to try and find in the Album that say they are referenced but really are not.
    Prior to this web journal problem showing up Aperture had been showing me many of these files were not online even though the drive was definitely hooked to the computer and I was able to go to the same images via the Finder and actually see that they were there. One minute the overall project registered images offline, I would click on an Album and they would register as Online. Then switch back to the Project and amazingly they register as online. Back down to the Album and it tells me they are off line. Back and forth from project to album and a different icon 50% of the time. I knew something was up.
    I eventually tracked down many of the images that said they were online but by reviewing them it was obvious they were not due to the jaggies I mentioned above. When I would find one like this I went to Manage Referenced Photos and reconnected the image even though it's telling me it is already connected. After doing this to many of the images I reproduced the web pages and they then showed up. I nearly had all the images showing up except for one that I must have missed in reconnecting so I went back to do just that. As I scrolled through the Album and the Web Journal, many of the thumbnails would turn gray and then finally an image would show up. This happened to dozens of images. I found the one that had not shown up in the last export of the web pages, reconnected it (even though it said it was connected) and then exported the web pages again. Unfortunately I was back to square one. Once again dozens of images were now not showing up in the export of the web pages again.
    I just can't believe how buggy 1.5.2 seems to be. I thought maybe it was something to do with Repairing Permissions so I went and did all of that. Still no luck! Anyone else experience anything like this? I'm about ready to give up on this software.

    Victor,
    Yes larger hard drives will help but the day they are large enough to fit in a laptop with a professional photographers entire collection is a long way off and may never happen. There is no reason why Referenced files needs to be so difficult. Two quality programs that handled it with ease was RAW Shooter (now gone having been bought by Adobe) and Photo Mechanic which is superb for some tasks. For Aperture to have this many issues with referencing images is unacceptable and the market place will bear this out. I've quite using the program all together and have gone back to Photo Mechanic combined with IView and Photoshop. There's still room for an Aperture like product but Apple better get moving to make it work better. Microsoft just announced some of the upcoming IView capabilities that will be available next year. Adobe has CS3 and Lightrooom and I'm guessing Photo Mechanic isn't resting on it's heels. I really, really wanted to like Aperture and I worked with it day in and day out for nearly two months. As time went on the Referenced files just kept getting more and more unstable and I lost a ton of work due to it no longer being able to see some of those files.
    MacBook Pro Mac OS X (10.4.7)
    MacBook Pro Mac OS X (10.4.7)
    MacBook Pro Mac OS X (10.4.7)

  • How to move referenced images to a new Hard Drive

    All my Aperture referenced images (about 80.000) are stored at a 300gb firewire HD. That's not enough and I plan to move all my photos to a new HD, 1Tb probably.
    I understand that I can't move the images directly from one drive to another. So what's the easiest and painless way to upgrade and still maintain the integrity of Aperture Library ?

    {quote:title=Bauhausler wrote:}I understand that I can't move the images directly from one drive to another.{quote}
    Well, that's exactly what you can (and should) do. Then use the "Manage Referenced Files..." command.
    Take a look at my answers in this recent thread:
    http://discussions.apple.com/thread.jspa?threadID=1721897
    Regards
    Paul K

  • Moving Referenced Images to a new HD

    Hi,
    I have my 500GB external HD almost full with all my Aperture referenced images.
    I got a new 1TB HD.
    I Would like to move all my original folders keeping Aperture modifications on the images (metadata, adjustments, etc...).
    Can I just copy the content of 500GB HD into the 1TB and somehow give to Aperture the path to the new HD? (the library file is on the computer's HD)
    Thanks!

    You can copy everything and then reconnect the files, but you'd be better off using the File>Relocate Masters... command.
    Ian

  • Exporting projects with referenced images

    I want to import referenced images from an external hard drive, edit them and then export the project in order to archive it. Is this something that I can do now? Will I end up with a bunch of referenced previews in my library and an exported project that can link back up to the master images that are on a separate hard drive?
    Antonio

    No, this only exports a "copy" of your projects and does not remove the master image. It is still in the Aperture Library. I am also trying to find an easy way to move the entire project outside of the library and still maintain a reference link to wherever I move the images to. Any thoughts?

  • Upgrading from Aperture 2-3. What happens to referenced images?

    I'm upgrading from Aperture 2 to 3. I have referenced images on some external hard drives. Will my referenced images be okay and still read correctly from my HD if I upgrade?

    Hi
    I had no problems it retained the Referenced File location info you will have to ensure the externals connected.
    If they are not linked as indicated by a red line through the referenced file icon bottom RH corner
    Select the images that need reconnecting and then go to File / Locate Referenced Files
    You will get a dialogue box which enables you to find the Referenced File/s then click Reconnect or Reconnect All
    I just had to do it because I renamed an external drive
    Hope this helps

  • Loupe Offline for Referenced Images?

    In the Aperture 3 documentation, we get this...
    Even though the masters are offline, you can browse, search, and assign metadata to preview images. You can even use the Loupe to zoom in on preview images, because they are high-quality JPEG files.
    And in Aperture 2, this was correct. Now that I have finally gotten around to upgrading to Aperture 3, I find this functionality is broken. The loupe is displayed as "offline" for referenced images and refuses to magnify my previews (though I can zoom in on them just fine).
    This is a big problem, because i rely on the loupe for sorting images, and don't always have my master images available.
    Is there a way to restore the loupe for viewing previews like Aperture 2?

    In the Aperture 3 documentation, we get this...
    Even though the masters are offline, you can browse, search, and assign metadata to preview images. You can even use the Loupe to zoom in on preview images, because they are high-quality JPEG files.
    And in Aperture 2, this was correct. Now that I have finally gotten around to upgrading to Aperture 3, I find this functionality is broken. The loupe is displayed as "offline" for referenced images and refuses to magnify my previews (though I can zoom in on them just fine).
    This is a big problem, because i rely on the loupe for sorting images, and don't always have my master images available.
    Is there a way to restore the loupe for viewing previews like Aperture 2?

  • Updating Referenced Image Folder names

    Hi,
    My Aperture library is a Referenced Library. My referenced images are stored on an external FW 800 drive and my file system is setup as: Folder Name/Project Name. This has worked great for me, but causes issues when I make changes to the organizational system of my library. I know that Aperture is smart enough to still link the correct files even if the folder/project system is off.
    My question is: How do you keep the folder system synced and intact when using a Referenced Library after making changes to the names of Projects, etc? Is this possible? If not, what system of fouler organization works best for keeping things simple, organized and in sync with as little confusion and downtime in terms of work flow?
    I'm looking for some general (and specific) ideas from users here.
    Thanks,
    Mac

    macorin wrote:
    The question for you is: What need are you trying to meet by mimicking in your Master file storage and retrieval structure?
    Kirby,
    First, thanks for the lengthy and helpful response. In thinking about what you wrote, I probably don't need to worry about my Master file storage structure. So long as Aperture is able to find my Masters no matter the folder, project, album they sit in, I should be fine. My initial thinking was that if I wanted to access my Masters (for some reason) outside of Aperture, it would be easier for me to know where everything was. That being said, I don't really ever need to do that, as everything can be done straight from within Aperture. Still, it just makes me a little uneasy knowing that my images are organized and structured one way in Aperture and another outside of it where those images are linked to.
    Don't let it make you uneasy. Even if they are all in one 55-gallon bag (or Finder folder), they are easily sorted by date (and time) taken, and by file name. These two alone -- esp. if you have renamed your Masters with a good and rigorously applied file-naming convention -- should meet every need you might have.
    Moreover, your Aperture Library of images should be deeply hyperlinked. That's a big reason to use Aperture. None of those hyperlinks are create-able in a file storage system.
    At the risk of being (even more) off-putting than usual: think on that. Beginning to understand that difference allows you to manage your data in much more successful ways.
    The second reason I was asking is because when I import into Aperture as a Referenced Library, I also back up those images to a second external hard disk. I generally keep this back up archive organized and structured the same way as my Masters structure. If I ever deleted a Referenced Master and then later on wanted to re-import it from my back up archive, it makes it easier to find things, etc if they are organized the same way.
    I don't buy it. Can you give an example of a situation in which you need to find a file and you don't know the date it was taken (at least roughly) or some part of the file name?
    Your Masters need almost no storage structure at all.
    IME, once I started using Aperture's extensive image management tools, I found I had almost no -- zero, nada -- file management needs beyond back-up.
    If you read what I wrote just above, I guess this plays to that. How do you manage your back-up file management system if things change in ways that I have suggested, i.e. renaming projects, etc and moving things around from one project to another?
    I try to keep two additional copies of every Library and every set of Referenced Masters at all times. One set is kept off-site. It's not hard to do -- but I do run copy operations that last all night. Aperture's Vault can serve as one of the Library copies. I have found it easier to manage when I don't use Vaults, so I stopped using them. If you find Vaults convenient, use them.
    Just to be clear: My main goal is to make sure that my back-up file management structure mimics my Aperture Library Folder, Project, Album (well, not album as you can't organize at this time by album name) structure. I am not talking about the structure of where my Masters are stored, but rather the structure of my back-up. I hope this makes sense.
    This does not make sense. +File management+ refers to Referenced Masters and not to Aperture Folders, Projects, or Albums.
    Your Aperture Folder, Project, & Albums (all of 'em) structure is part of your Library. Back up your Library, and you have backed up that structure.
    The files an Aperture user needs to back up are
    - your Aperture Library (an OS X package of hundreds of thousands of files)
    - all your Referenced Masters.
    That's it.

  • Corruption of the Location of Referenced Images

    In other threads we have discussed problems with Aperture becoming confused about which referenced files it is supposed to connect with. Here is my analysis of one aspect of this problem.
    When you have a group of referenced files, if you move some of them to another folder on the same volume or rename them Aperture attempts to find the moved file and change the reference to it. This might be what you want, or it might not, so Aperture ought to ask you whether to change the reference or not. But it does not.
    If the volume on which you have your original files is not mounted, Aperture will mark the files as unavailable but will not change any links. This is clearly the behavior one would expect.
    A problem occurs when your files are missing, but the volume they were on is mounted. This might happen if, for example, if one of your folders had been inadvertently deleted and needed to be reclaimed from a backup disk. In this situation Aperture "reconnects" the references in your Aperture library to what appears to be arbitrary files on the volume. The new references likely bear no relation to the files you really want. This is clearly not the behavior you would expect or want. When this happens it is usually impossible to use the "Manage Referenced Files" command to reconnect the files, because the correct files and the ones now referenced in the database aren't the same size and don't share the characteristics which permit the "Reconnect" button to be enabled when the reference and correct file are selected in the "Referenced File" dialog. Even the "option key" trick which sometimes allows the "Reconnect" button to be forcibly enabled will not work once this happens.
    Obviously, this is a potentially catastrophic issue if a huge number of file references become corrupted in your library. The only way to fix things that I have found is to reimport all of the correct referenced image files, then lift and stamp metadata and image corrections from the corrupt reference entries in the library to the "new" referenced files. This is extraordinarily tedious if the number of files affected is large.
    In any event, this is a serious bug and it should have been found long ago in Apple quality assurance testing and fixed. It ought also to be possible to just hand enter the correct reference to a referenced image in the library if nothing else works.

    Possibly going to settings, general, international, region format, then select the country you are in.

  • Coloring an image through code

    Hey guys,
    With a basic knowledge of the iphone SDK by now I've been playing around with some code and as expected stumbled upon "a pretty hard to do" idea.
    I was wondering how to color the contents of an image through code. Basically something like the "Fill" photoshop effect. Meaning: a UIImage containing a transparent png. The image is a drawing of a star, the outside is transparent, the lines are black and the inner color is purple.
    Through code I'd love to find out how to alter the purple color for example with a red one or any other.
    Any ideas / help would be appreciated...

    Search on MacUpdate using 'home decorate' as a search term.
    Regards
    TD

  • Loading saved images from code

         I'm creating a single-page application with CQ and AngularJS, and the nature of my app is requiring that I pull my images from code rather than into a paragraph system via the UI. Does anyone know how to accomplish this? Does CQ have some built-in methods for pulling that resource from an image name or something?

    Your reply has a lot of good info in it, thanks. I'm not using a clientlib anywhere, though it sounds like I should be. Let me describe a little better where I'm at, and maybe you can make some suggestions. I've been using CQ for about two months now.
    I have a roughly 8-page application that I'm working on. Adobe CQ is being used only for the UI side. All persistence and business logic is being done on a completely separate server that I'm connecting to via RESTful services using a single, master JSON string which contains all the information I need at all steps of the process. The navigation is essentially a wizard-style sequence where each step results in a round trip of the JSON to and from the server. I have four separate brandings that I'll have to do, based on that which is associated with a particular user.
    My solution so far is a single-page application based on AngularJS. This means I have a "main" page in CQ which uses "maintemplate" attached to a "maintemplate.jsp" component that includes a parsys where I drop an "angularview" component.
    This page renders out the header and footer of my app to the browser, with an empty div where the Angular view will be placed. Each of the pages in my app I have created in pages underneath "main", pointing to another template called "partialtemplate", which does nothing to the component each page calls (no header, footer, etc.).
    Each of these partial page components contain a mix of text, images, and form elements. The images in these partial pages are what I'm concerned about. There's no way to edit these in the authoring view, since I'm not using CQ's full-page-refresh navigation model. So, I have to hard code all the images, text and other content into each partial component.
    I have all my components in /apps/project/components, and the partials underneath that in /components/partials. Javascript files I have in /components/js (this is probably where I need to use a clientlib) and I'm using relative URLs from the maintemplate component to pull them. I'm also using /etc/designs/project as a location for all my css.
    My idea for the branding will be to programmatically adjust the current design path depending on user data (I haven't verified this will work) and create a new design path for each, with sling:superResourceType pointing to the master design so I don't have to have multiple copies of global css files.
    The images in question are inside each of the partials. Since they might change based on marketing goals, I need these to remain exposed to the page authors, so putting them in the DAM is the only choice I see; indeed, isn't that what the DAM is for?
    I'm still fumbling through CQ, trying to find out the best way to do things. If you can make any recommendations, I'd be grateful. Time is precious, so I don't have a lot of time to rewrite the architecture, but if you see some way I can make a small change and save myself some work later, I'm all ears.

  • How can I tell whether a project has managed or referenced images

    Hi all,
    Another noob question.
    I started working with Aperture and imported about 20GB of photos from my hard drive into one big project. But I can't remember whether I imported them as managed or referenced images. I want to clean up my drive and delete one set of these if they're duplicates.
    Is there an easy way to determing if the images in the Library are managed or referenced? I've looked all over for an answer, but can't find one.
    Thank you!

    The "badges" in the lower right corner of each image will tell you if the image is a "referenced" image.
    See this page for an explanation of the badges: http://documentation.apple.com/en/aperture/usermanual/index.html#chapter=11%26se ction=9%26tasks=true
    The badge icon will either be a small rectangle (which represents your photo) with an arrow (indicating that the real photo is elsewhere -- aka "referenced", or it will the rectangle will have a red slash through it, meaning it's a referenced image but the master is currently offline.
    There's a third possible icon... which is yellow warning triangle (has a "!" in it) with the arrow. This means the referenced master was not found (e.g. the Mac can find the filesystem & folder, but your image is not there.) This means someone decided to delete or move images in the filesystem -- bypassing Aperture.
    On a related note... it is possible to change your mind about whether you want images to be "referenced" vs. "managed". The "Aperture" -> "File" -> "Relocate Master..." will allow you to pick a folder on the hard drive and Aperture will copy the masters to that location -- converting a "managed" image into a "referenced" image. The "Aperture" -> "File" -> "Consolidate Master..." will do the opposite... it will convert a referenced image to a managed image, but does offer the choice of whether the "copy" vs. "move" (e.g. do you want to leave a copy of the image out in the filesystem which is no longer associated with Aperture vs. have the only copy of the master living inside the Aperture library.)
    Message was edited by: Tim Campbell1

Maybe you are looking for

  • Fact sheet to show up Campaign Elements

    Hi, Is it possible to show Campaign Elements in Fact sheet. Campaign element needs to be based on the customer which is in Target group of that particular BP. It is not on the basis of  Employee responsible of campaign element. Say for example if cus

  • 4.6C migration from HP-UX to Linux

    Hi all, we are planning to move the current 4.6C environment from HP-UX to Linux platform. we need help with a couple of things that are posted below. 1. Is 4.6c compatible on RH Linux 11.31. 2. Do we need a seperate liscense for Linux or can we use

  • Passing int[] parameter to PL/SQL stored proc via SQLJ

    This should be easy. I want to pass an array of Java integers i.e. int[] as an IN parameter to a PL/SQL stored procedure that expects a TABLE OF INTEGER. But SQLJ keeps giving me an error when I try to call the procedure, saying that int[] is an unsu

  • Traffic Lights - SAP CRM 7 - User's Inbox

    Hi All, How can we configure trafic lights for transactions displayed in the users inbox ( SAP CRM 7). Are the traffic lights controlled by the due date in the date profile ? What is logic used by the system to assign colors to each of the transactio

  • Getting first occurrence of XML elements

    Hi All, My XML tag looks like this: <xref rid="id001" ref-type="Test"> <xref rid="id002" ref-type="Test"> <xref rid="id003" ref-type="Test"> <xref rid="id004" ref-type="Test"> Code: var root = app.activeDocument.xmlElements[0]; var xrefRid = root.eva