Our Blog

In response to a comment in a previous post "Binding an image to a cfgrid" I made a new example that loads thumbnails inside a grid, and when you click in a row, it displays the picture via binding.

<cfform name="myform" height="300" width="600" format="Flash" timeout="100">
   <cfformgroup type="horizontal">
   <cfgrid name= "grid" rowHeight="50" rowheaders="false" query="properties" width="250" height="230">
      <cfgridcolumn type="image" width="40" name="thum" header="Photo">                                       
      <cfgridcolumn name="city" header="City">               
   </cfgrid>
   <!--- show the picture in an html cfformitem
       paragraph is added because Firefox sometimes fail to load the picture --->
                  
   <cfformitem type="html" height="200" width="300"
            bind="<p><img src='images/{grid.selectedItem.photo}'></p>"
></cfformitem>
   </cfformgroup>
</cfform>

Note: Sometimes some of the pictures do not load (may be a bug?)
Update: I posted a fix to that bug and an update of this technique using the CF updater 7.01

View live example
Download source

Nahuel Foronda

Nahuel Foronda

24 Comments

  1. Casey Corcoran
    &quot;Sometimes some of the pictures do not load&quot;

    They all loaded for me but then some disappear. Strange.
  2. JesterXL
    Same here; they load, but immediately disappear. The ones off to the right work fine, though.
  3. Lenny
    I am looking to do this exact thing how ever im am trying to pull the data from a database.
    Example click row and image associated with that row in database appears. Any ideas?

    Thanks.
  4. Mika
    Here is what i've found, could be helpful. Looks little strange, but works.

    &lt;cfquery datasource=&quot;crafts&quot; name=&quot;random_images&quot; maxrows=&quot;4&quot;&gt;
    SELECT product_id, product_name, product_image3 FROM products
    &lt;/cfquery&gt;
    &lt;cfset MyList=ValueList(random_images.product_image3,',')&gt;
    &lt;cfset path_1=&quot;http://localhost:8500/armenianrugmasters/images/#ListGetAt(MyList, 1)#&quot;&gt;
    &lt;cfset path_2=&quot;http://localhost:8500/armenianrugmasters/images/#ListGetAt(MyList, 2)#&quot;&gt;
    &lt;cfset path_3=&quot;http://localhost:8500/armenianrugmasters/images/#ListGetAt(MyList, 3)#&quot;&gt;
    &lt;cfset path_4=&quot;http://localhost:8500/armenianrugmasters/images/#ListGetAt(MyList, 4)#&quot;&gt;
    &lt;cfform method=&quot;get&quot; format=&quot;flash&quot; &gt;

    &lt;cfformgroup type=&quot;horizontal&quot; height=&quot;200&quot; width=&quot;700&quot; visible=&quot;yes&quot; enabled=&quot;yes&quot; &gt;
    &lt;div align=&quot;center&quot;&gt;
    &lt;cfinput type=&quot;image&quot; name=&quot;image1&quot; src=&quot;#path_1#&quot; width=&quot;150&quot; height=&quot;170&quot;/&gt;
    &lt;cfinput type=&quot;image&quot; name=&quot;image2&quot; src=&quot;#path_2#&quot; width=&quot;150&quot; height=&quot;170&quot;/&gt;
    &lt;cfinput type=&quot;image&quot; name=&quot;image3&quot; src=&quot;#path_3#&quot; width=&quot;150&quot; height=&quot;170&quot;/&gt;
    &lt;cfinput type=&quot;image&quot; name=&quot;image4&quot; src=&quot;#path_4#&quot; width=&quot;150&quot; height=&quot;170&quot;/&gt;
    &lt;/div&gt;
    &lt;/cfformgroup&gt;



    &lt;/cfform&gt;

    Mika
  5. David
    I'm gettign the same problem in Safari, the thumbnails load the disappear. Any idea how I can fix that, or will that be addressed with the CFMX 7.0.1 updater?
  6. David,
    The problem is that the player has the bug. And they didn't fixed in the last release ( 8 ).
  7. Sami Hoda

    Sami Hoda

    Any update on this disappearing image issue?
  8. Laura
    Sami,
    Yes, I do have a &quot;fix&quot; that seems to help. I've been preparing a couple of examples and it will be my next post. Stay tuned.
  9. Joshua Buttler
    I am a beginning to intermediate CF developer and you really inspire me to dig in and stretch my knowledge to the next level. Thank you. Excellent site. Is there a way to make a cfgrid display images in a horizontal repeater? I have seen it done in the flex exampe store so I will do some digging there but if you happen to get a chance, let me know.

    Thanks again for all of your great info!
    God Bless
  10. thomary

    thomary

    You people are GREAT. Thanks for all the work.
    I would really appreciate any help with loading an image from a cfgrid.
    Looking around these blogs I have tried many different lines. None worked.
    The query works, the filter works, the bind to get the name of the file from the query works.
    It's the loading of the picture I can not get. Any help would be greatly appreciated. partial code is below.

    SELECT *
    FROM tblidmstr LEFT JOIN tblpictures ON tblidmstr.EmployeeID = tblpictures.EmployeeID
    WHERE tblidmstr.Division = &quot;99&quot;
    ORDER BY tblidmstr.LastName, tblidmstr.FirstName

    &lt;cfgrid name= &quot;data&quot; query=&quot;getArtists&quot; height=&quot;180&quot; width=&quot;500&quot; rowheaders=&quot;false&quot;&gt;
    &lt;cfgridcolumn name=&quot;LastName&quot; header=&quot;LastName2&quot; width=&quot;100&quot;&gt;
    &lt;cfgridcolumn name=&quot;FirstName&quot; header=&quot;FirstName2&quot; width=&quot;80&quot;&gt;
    &lt;cfgridcolumn name=&quot;File&quot; header=&quot;File&quot; width=&quot;75&quot;&gt; &lt;!--- not all names have a file ---&gt;
    &lt;/cfgrid&gt;

    &lt;cfinput type=&quot;image&quot; src=&quot;../../..//images/1234.jpg&quot; name=&quot;venpic&quot;&gt;
    &lt;!--- This works but I need the &quot;File&quot; name of the item selected n the grid---&gt;
    &lt;cfformitem type=&quot;html&quot; name=&quot;vpic&quot; height=&quot;219&quot; width=&quot;176&quot; bind=&quot;{'&lt;p&gt;&lt;img src=\'/images/'+data.selectedItem.File+ '\'&gt;&lt;/p&gt;'}&quot;&gt;&lt;/cfformitem&gt;
    &lt;cfinput type=&quot;image&quot; name=&quot;vpic&quot; height=&quot;219&quot; width=&quot;176&quot; bind=&quot;{'&lt;p&gt;&lt;img src=\'/images/'+data.selectedItem.File+ '\'&gt;&lt;/p&gt;'}&quot;&gt;
    &lt;cfinput type=&quot;image&quot; name=&quot;vpic&quot; height=&quot;300&quot; width=&quot;200&quot; bind=&quot;{'&lt;p&gt;&lt;img src=\'images/'+data.selectedItem.File+ '\'&gt;&lt;/p&gt;'}&quot;&gt;
    &lt;cfinput type=&quot;image&quot; name=&quot;vpic&quot; height=&quot;300&quot; width=&quot;200&quot; bind=&quot;{'&lt;p&gt;&lt;img src=\'../../..//images/'+data.selectedItem.File+ '\'&gt;&lt;/p&gt;'}&quot;&gt;
    &lt;cfinput type=&quot;image&quot; name=&quot;vpic&quot; height=&quot;300&quot; width=&quot;200&quot; bind=&quot;{'&lt;p&gt;&lt;img src=\'images/'+data.selectedIndex.File+ '\'&gt;&lt;/p&gt;'}&quot;&gt;
    &lt;cfinput type=&quot;image&quot; name=&quot;vpic&quot; height=&quot;300&quot; width=&quot;200&quot; bind=&quot;{'&lt;p&gt;&lt;img src=\'../../..//images/'+data.selectedIndex.File+ '\'&gt;&lt;/p&gt;'}&quot;&gt;

    &lt;cfformitem type=&quot;html&quot; name=&quot;vpic&quot; height=&quot;300&quot; width=&quot;200&quot; bind=&quot;{'&lt;p&gt;&lt;img src=\'images/'+data.selectedIndex.File+ '\'&gt;&lt;/p&gt;'}&quot;&gt;&lt;/cfformitem&gt;
    &lt;cfformitem type=&quot;html&quot; name=&quot;vpic&quot; height=&quot;300&quot; width=&quot;200&quot; bind=&quot;{'&lt;p&gt;&lt;img src=\'../../..//images/'+data.selectedIndex.File+ '\'&gt;&lt;/p&gt;'}&quot;&gt;&lt;/cfformitem&gt;
    &lt;!--- None of these work. I've tried many different combinations and can not get the picture to show when selected? ---&gt;

    &lt;cfinput type=&quot;text&quot; name=&quot;file&quot; label=&quot;File&quot; Size=&quot;20&quot; disabled=&quot;yes&quot; bind=&quot;{data.dataProvider[data.selectedIndex]['File']}&quot;&gt;
    &lt;!--- This works. It fills in the correct file name from the quey. This file name corresponds to the picture located in - NetDrive:\WebUpload\MyPictureplace\Pictures\File.jpg
  11. Laura
    thomary,
    are your pictures web-accessible? Why are your pictures located at pictures/ and you reference images/?
    To debug it, try to use an absolute path (the path from the root of your domain) like /images/file.jpg and see if it works. Also try harcoding the file, just &lt;cfforimitem&gt;&lt;p&gt;&lt;img src...&gt;&lt;p&gt;&lt;/cfformitem&gt;. You should be able to see it that way and work from there. I would recommend not to use ../../../ etc... just not readable and difficult to know what the final path will be.
  12. Thomary

    Thomary

    The problem is my pictures are located outside the inetpub\wwwroot\.
    The intranet server admin says he doesn't want to move these jpg's into wwwroot for security reasons.
    When I copy some over into inetpub\wwwroot\ (in the directory I'm working in) all the copied pictures show. The server admin made the original location a vertual directory and still the pictures do not show. I tried to set the absolute path. This did not work. I wonder if I was doing it correctly. I'm still a novice with CF and Flash. I entered
    &lt;cfformitem type=&quot;html&quot; height=&quot;300&quot; width=&quot;200&quot;
    bind=&quot;&lt;p&gt;&lt;img src='&lt;p&gt;&lt;img src='P:\WebUploads\Databases\Operations\Pictures\{data.selectedItem.File}'&gt;&lt;/p&gt;&quot;&gt;&lt;/cfformitem&gt;
    &lt;cfformitem type=&quot;html&quot; height=&quot;300&quot; width=&quot;200&quot;
    bind=&quot;&lt;p&gt;&lt;img src='&lt;p&gt;&lt;img src='P:/WebUploads/Databases/Operations/Pictures/{data.selectedItem.File}'&gt;&lt;/p&gt;&quot;&gt;&lt;/cfformitem&gt;
    I even tried it with the cfinput type=&quot;image&quot; nothing is working with the pictures outside the inetput directory. Can you help me get the correct path syntax?

    Below is what worked (one only works when I already view the picture in the first example.
    &lt;!---   Manual entry of filename - Works ---&gt;
    &lt;cfinput type=&quot;image&quot; name=&quot;abcdef&quot; src=&quot;../../..//images/V999.jpg&quot;&gt;
    &lt;!---   Binding grid to filename with pictures copied into this directory - works (shows pictures that were copied here    ---&gt;
    &lt;cfformitem type=&quot;html&quot; height=&quot;300&quot; width=&quot;200&quot;
    bind=&quot;&lt;p&gt;&lt;img src='images/{data.selectedItem.File}'&gt;&lt;/p&gt;&quot;&gt;&lt;/cfformitem&gt;
    &lt;!---Binding grid to pictures outside inetpub/wwwroot - only works for files already loaded manually, saved and viewed. If I shutdown and restart the pictures that were entered manually don't show. Is there some where the jpg's are cached?   ---&gt;
    &lt;cfformitem type=&quot;html&quot; height=&quot;300&quot; width=&quot;200&quot; bind=&quot;{'&lt;p&gt;&lt;img src=\'../../..//images/'+data.dataProvider[data.selectedIndex]['File']+'\'&gt;&lt;/p&gt;'}&quot;&gt;&lt;/cfformitem&gt;

    Thanks for any help.
  13. Laura
    Thomary,
    I am not sure what you are doing, but this is the general rule: you are creating a little piece of html in the form, so think of it as html. If you were to show an image in html, you would use &lt;img&gt; and the image *has* to be accessible by the browser. The same rules for paths apply here. if you use ../ you are refering to the directory above the one the calling template is located. But you can't go any higher than your domain root (http://www.example.com). Referencing the server drive does not work either (where is the browser supposed to find that file??)
    Virtual directories should work. Test your path in a regular html page with
    &lt;p&gt;&lt;img src=&quot;images/somefile.jpg&quot;&gt;&lt;/p&gt;

    By absolute path I mean starting from your web root down to the correct directory, like &quot;/somedir/images/myfile.jpg&quot;

    Lastly, it is the browser that loads the images, so that is the only place where they can be cached.
  14. Thomary

    Thomary

    THANK YOU sooo much. I was able to copy another page. Used their html and mixed it with mine. I can not believe it is working. You are wonderful! Thanks again for letting us beginners chat with you (even when you can't understand what we're saying you help beyond belief).
  15. I have loaded up the sample and then tried a little proof of concept using a simple cfquery. I am not getting any of the images to load at all.



    &lt;cfquery name='GetArtwork' datasource='datasourcename'&gt;
       SELECT ArtGalleryID,
             ArtPathURL + '' + ArtName AS Art_Images,
             ArtName,
             ArtTitle,
             ArtDescription
       FROM ArtGallery
       ORDER BY ArtGalleryID DESC
    &lt;/cfquery&gt;
    &lt;cfoutput query='GetArtWork'&gt;
       Image and Path: #Art_Images#&lt;br /&gt;
    &lt;/cfoutput&gt;
    &lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.01 Transitional//EN&quot; &quot;http://www.w3.org/TR/html4/loose.dtd&quot;&gt;
    &lt;html style=&quot;margin:0; height:100%;&quot;&gt;
    &lt;head&gt;
       &lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=iso-8859-1&quot;&gt;
       &lt;title&gt;cfgrid labelFunction - show images in grid&lt;/title&gt;
    &lt;/head&gt;
    &lt;cfif GetArtwork.Recordcount lt 1&gt;
       &lt;div class='required'&gt;There are no images to view at this time!!&lt;/div&gt;
    &lt;cfelse&gt;
          &lt;cfform name=&quot;myform&quot; height=&quot;300&quot; width=&quot;600&quot; format=&quot;Flash&quot; timeout=&quot;100&quot;&gt;
             &lt;cfformgroup type=&quot;horizontal&quot;&gt;
             &lt;cfgrid name= &quot;grid&quot; rowHeight=&quot;50&quot; rowheaders=&quot;false&quot; query=&quot;GetArtwork&quot; width=&quot;250&quot; height=&quot;230&quot;&gt;
                &lt;cfgridcolumn type=&quot;image&quot; width=&quot;40&quot; name=&quot;Art_Images&quot; header=&quot;Photo&quot;&gt;                                       
                &lt;cfgridcolumn name=&quot;ArtTitle&quot; header=&quot;Art Title&quot;&gt;               
             &lt;/cfgrid&gt;
             &lt;!--- show the picture in an html cfforitem
                 paragraph is added because Firefox sometimes fail to load the picture ---&gt;                  
             &lt;cfformitem type=&quot;html&quot; height=&quot;200&quot; width=&quot;300&quot;
                      bind=&quot;{'&lt;p&gt;&lt;img src=\'/Admin/Gallery_Images/'+grid.selectedItem.ArtName+ '\'&gt;&lt;/p&gt;'}&quot;&gt;&lt;/cfformitem&gt;
             &lt;/cfformgroup&gt;
          &lt;/cfform&gt;
    &lt;/cfif&gt;
    &lt;/body&gt;
    &lt;/html&gt;
  16. I have loaded up the sample and then tried a little proof of concept using a simple cfquery. I am not getting any of the images to load at all.



    &lt;cfquery name='GetArtwork' datasource='datasourcename'&gt;
       SELECT ArtGalleryID,
             ArtPathURL + '' + ArtName AS Art_Images,
             ArtName,
             ArtTitle,
             ArtDescription
       FROM ArtGallery
       ORDER BY ArtGalleryID DESC
    &lt;/cfquery&gt;
    &lt;cfoutput query='GetArtWork'&gt;
       Image and Path: #Art_Images#&lt;br /&gt;
    &lt;/cfoutput&gt;
    &lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.01 Transitional//EN&quot; &quot;http://www.w3.org/TR/html4/loose.dtd&quot;&gt;
    &lt;html style=&quot;margin:0; height:100%;&quot;&gt;
    &lt;head&gt;
       &lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=iso-8859-1&quot;&gt;
       &lt;title&gt;cfgrid labelFunction - show images in grid&lt;/title&gt;
    &lt;/head&gt;
    &lt;cfif GetArtwork.Recordcount lt 1&gt;
       &lt;div class='required'&gt;There are no images to view at this time!!&lt;/div&gt;
    &lt;cfelse&gt;
          &lt;cfform name=&quot;myform&quot; height=&quot;300&quot; width=&quot;600&quot; format=&quot;Flash&quot; timeout=&quot;100&quot;&gt;
             &lt;cfformgroup type=&quot;horizontal&quot;&gt;
             &lt;cfgrid name= &quot;grid&quot; rowHeight=&quot;50&quot; rowheaders=&quot;false&quot; query=&quot;GetArtwork&quot; width=&quot;250&quot; height=&quot;230&quot;&gt;
                &lt;cfgridcolumn type=&quot;image&quot; width=&quot;40&quot; name=&quot;Art_Images&quot; header=&quot;Photo&quot;&gt;                                       
                &lt;cfgridcolumn name=&quot;ArtTitle&quot; header=&quot;Art Title&quot;&gt;               
             &lt;/cfgrid&gt;
             &lt;!--- show the picture in an html cfforitem
                 paragraph is added because Firefox sometimes fail to load the picture ---&gt;                  
             &lt;cfformitem type=&quot;html&quot; height=&quot;200&quot; width=&quot;300&quot;
                      bind=&quot;{'&lt;p&gt;&lt;img src=\'/Admin/Gallery_Images/'+grid.selectedItem.ArtName+ '\'&gt;&lt;/p&gt;'}&quot;&gt;&lt;/cfformitem&gt;
             &lt;/cfformgroup&gt;
          &lt;/cfform&gt;
    &lt;/cfif&gt;
    &lt;/body&gt;
    &lt;/html&gt;
  17. mindriot

    mindriot

    My image names are stored in the database. I am trying to find a way to display the images, not the image name in a CFGRID. Any suggestions?

    <cfquery name="getrecord" datasource="getemployee" username="blah" password="blah!">
    SELECT *
    FROM blah
    </cfquery>
    <cfoutput>
    <cfform name="myform" format="Flash" timeout="10000" width="600">
       <cfformgroup type="horizontal">
    <cfoutput>
    <cfscript>
       title = "Binding an image to a cfgrid with thumbnail";
       getrecord = queryNew("id,photo");
       queryAddRow(getrecord);
          querySetCell(getrecord,'photo', '#photo#');
    </cfscript>
    </cfoutput>
          <cfgrid name= "grid" rowheight="50" rowheaders="false" query="getrecord">
              <cfgridcolumn type="image" name="photo" display="yes">
              <cfgridrow data="photo">
              <cfgridcolumn name="FirstName" header="Name">
              <cfgridrow data="name">
              <cfgridcolumn name="Position" header="Position">
              <cfgridrow data="position">
              <cfgridcolumn name="Dept" header="Department">
              <cfgridrow data="department">
              <cfgridcolumn name="Extension" header="Extension">
              <cfgridrow data="extension">
          </cfgrid>
       </cfformgroup>
    <cfformitem type="html" height="200" width="300" bind="<p><img src='images/{grid.selectedItem.photo}'></p>">
    </cfformitem>
    </cfform>
    </cfoutput>
  18. Laura
    mindriot,
    I don't really understand your question. That is what the example in the post does, showing a picture in the datagrid given the filename in the query. In any case, remove the cfgridrow tags, they are not needed. Also, you don't need to create another query, you can use "getemployee" query directly.
    Note: If the photo is too big, it might get cropped.
  19. mindriot

    mindriot

    Hi Laura,

    Sorry for the confusion. I found my solution to my issue yesterday trying to display images from the image path that was in the db. Unfortunately my issue was not of the cfgrid, but with mysql. I usually deal with strictly mssql so my syntax was a little off. Well anyways here is what I came up with if anyone is interested.

    <cfparam name="URL.ID" default="1">
    <cfparam name="URL.Name" default="1">
    <cfparam name="PageNum_getrecord" default="1">
    <cfquery name="getrecord" datasource="blah" >
    SELECT *,concat('images/' , 'thumb/', `FirstName` ,`LastName`, '.jpg') as Image, concat(`FirstName`, ' ' , `LastName`) as Name
    FROM employees
    </cfquery>
    <cfoutput>
    <cfform name="myform" format="Flash" timeout="100" width="600" onload="formOnLoad()">
       <cfformgroup type="horizontal">
          <cfgrid
          name= "getrecord"
          rowheight="40"
          rowheaders="false"
          query="getrecord"
          onchange="getUrl('Employee_Detail.cfm?ID=' +getrecord.dataProvider[getrecord.selectedIndex]['ID']);">
              <cfgridcolumn name="id" header="id" type="numeric" display="no" >
              <cfgridcolumn name="Image" type="image" width="30" dataalign="center" header="" display="yes">
              <cfgridcolumn name="Name" header="Name" width="100">
              <cfgridcolumn name="Position" header="Position" width="125">
              <cfgridcolumn name="Dept" header="Department" width="115">
              <cfgridcolumn name="Extension" header="Extension" width="50">
          </cfgrid>
        </cfformgroup>
    </cfform>
    </cfoutput>
  20. Laura
    mindriot,
    I'm glad you got it working. Just so you know, you can create the complete path in the query like you did, or use labelFunction to set the complete path on the client side instead: http://www.asfusion.com/blog/entry/using-labelfunction-to-format-cfgrid (see 3rd example). The same goes for the name column.
  21. Corey
    I find that my images are restricted to a maximum size under 100px. Has anyone discovered a way to increase this maximum size or is this a limitation of the cfgrid that we must live with?
  22. Laura
    Corey,
    I've seen it accepting bigger images, but I was never able to pinpoint what made it work. I think that it something we must live with :(
  23. Dan
    Hi,
    I have bee trying to use a cgi process to create an image on the fly vs using canned images. My images would never appear no matter what I did coding-wise. I finally discovered that Flash doesn't like URLs that don't have .jpg in them.

    My cgi used to look like this:
    <cfform item="html" height="200" width="205" bind="{'<p><img src=\'/cgi-bin/makeThumb.pl?url='+urllist.selectedItem.url+'&sizeh=200&sizev=205\'></p>'}"></cfformitem>

    Flash would never even try to fetch this URL. By adding one additional parameter to the CGI (ext=.jpg) Flash happily issues the call, my CGI fires and voila my image appears.

    I wanted to share this as it opens up additional functionality.
  24. Maggie

    Maggie

    I'm having a really frustrating issue. In the example, whatever I set the rowHeight to, the datagrid behaves as it should. However, in my form, the rowHeight parameter is ignored as soon as I add the cfgridcolumn with a type of image to it.

    Here is my code:

    <cfgrid name="dgSomeList" rowheight="15" rowheaders="false" query="qSomeQuery" height="250" style="useRollOver: false;">
                            <cfgridcolumn name="PRODUCT" header="Product" width="75"/>
                            <cfgridcolumn name="IMPACT" header="Impact" width="15" />
                            <cfgridcolumn name="PRODUCTSTATUS" type="image" header="Status" width="25"/>
                            <cfgridcolumn name="NUMBEROFLESSONS" header="## of Lessons" type="numeric" width="35" />
                            <cfgridcolumn name="NUMBEROFPAGES" header="## of Pages" type="numeric" width="35" />
                            <cfgridcolumn name="HOURSREQUIRED" header="Man Hrs Required" type="numeric" width="65" />
                            </cfgrid>

    Is there anything that I am missing that would render the rowHeight inoperable? This data grid is embedded within a panel and tab navigator, if that has any impact. I ask this, because I had a similar issue with multiple select boxes working in a bare bones flash form, and once I put them in the panel they won't allow any selection. I'm not sure how to fix that either, but that can be for another post.

    Any help would be greatly appreciated!