Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > Other ASP.NET > BOOK: Beginning ASP.NET Web Pages with WebMatrix
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Beginning ASP.NET Web Pages with WebMatrix
This is the forum to discuss the Wrox book Beginning ASP.NET Web Pages with WebMatrix by Mike Brind, Imar Spaanjaars ; ISBN: 978-1-1180-5048-4
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET Web Pages with WebMatrix section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old January 17th, 2012, 12:44 PM
Authorized User
Points: 221, Level: 4
Points: 221, Level: 4 Points: 221, Level: 4 Points: 221, Level: 4
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2010
Posts: 50
Thanks: 7
Thanked 0 Times in 0 Posts
Default Chapter 8:Resizing Uploaded images.

Hi,

I am having issues with my gallery. I have upload 3 or 4 images to my upload folder, but when I run the gallery.cshtml page i only get 1 image to display. Also, when I click on the thumbnail the Fancybox doesn't seem to work I get a new page with the larger image. Please help, Thanks

This is the message I get from firebug in Firefox:

If <script> tags have a "type" attribute, it should equal "text/javascript" or "application/javascript". Also scripts must be parsable (syntactically correct).

I see text/javascript in the appropriate places.
Code:
Code:
@{
    var folderName="";
    var path="";
    var files=new List<string>();
    if(Request.Cookies["folder"] != null){
        folderName =Request.Cookies["folder"].Value;
        path=Path.Combine(Server.MapPath("/Uploads/"), folderName);
        foreach(var file in Directory.GetFiles(path)){
            if(Path.GetFileName(file).Contains("_thumb_")){
                files.Add(Path.GetFileName(file));
            }
        }
    }
}
<!DOCTYPE html>

<html lang="en">
    <head>
        <meta charset="utf-8" />
        <title>Gallery</title>
        
        <link rel="stylesheet" href="@Href("~/Content/tinycarousel.css")" type="text/css" />
        <link rel="stylesheet" href="@Href("~/Content/jquery.fancybox-1.3.4.css")" type="text/css" />
        <script type="text/javascript" src="@Href("~/Scripts/jquery-1.7.1.min.js")"></script>
        <script type="text/javascript" src="@Href("~/Scripts/jquery.tinycarousel.min.js")"></script>
        <script type="text/javascript" src="@Href("~/Scripts/jquery.fancybox-1.3.4.pack.js")"></script>
        <script type="text/javascipt">
            $(document).ready(function(){
                $('#slider-code').tinycarousel();
                $('.thumb').fancybox();
            });
        </script>
    </head>
    <body>
       <h3>Gallery</h3>
        <div id="slider-code">
            <a class="buttons prev" href="#">left</a>
            <div class="viewport">
                <ul class="overview">
                    @foreach(var file in files){
                        <li>
                            <a class="thumb" href="Uploads/@folderName/@file.Replace("_thumb", "")">
                            <img src="Uploads/@folderName/@file" alt=""/>
                            </a>
                        </li>
                    }
                </ul>
        </div>
        <a class="buttons next" href="#">right</a>
        </div>
    </body>
</html>
Reply With Quote
  #2 (permalink)  
Old January 18th, 2012, 08:52 AM
Imar's Avatar
Wrox Author
Points: 72,073, Level: 100
Points: 72,073, Level: 100 Points: 72,073, Level: 100 Points: 72,073, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

Take a look at this:

Code:
 
<script type="text/javascipt">
You have javascipt instead of javascript with an r....

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
Reply With Quote
  #3 (permalink)  
Old January 18th, 2012, 09:56 AM
Authorized User
Points: 221, Level: 4
Points: 221, Level: 4 Points: 221, Level: 4 Points: 221, Level: 4
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2010
Posts: 50
Thanks: 7
Thanked 0 Times in 0 Posts
Default

Thanks Imar.

I have another issue I uploaded other pictures into the upload folder but when I run the gallery only 1 picture is displaying and not any others. I think its because I need to delete the cookie and then run the page. If that's so how can I programatically delete the cookie and have new one set so its not manually done?

Thanks.
Reply With Quote
  #4 (permalink)  
Old January 18th, 2012, 10:02 AM
Imar's Avatar
Wrox Author
Points: 72,073, Level: 100
Points: 72,073, Level: 100 Points: 72,073, Level: 100 Points: 72,073, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

To delete a cookie, you can set the expiry date to a date in the past (using something like DateTime.Now.AddYears(-1) for example. Then the browser will clean it up for you.

Cheers,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
Reply With Quote
The Following User Says Thank You to Imar For This Useful Post:
hozdaman (January 18th, 2012)
  #5 (permalink)  
Old October 8th, 2012, 12:57 PM
Authorized User
Points: 60, Level: 1
Points: 60, Level: 1 Points: 60, Level: 1 Points: 60, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Feb 2007
Location: , , .
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Default Image Gallery chapter 8 not working

I'm having the same problem with the image gallery. I only see one image and the arrow buttons don't work.. in other words they don't slide to the other images in either direction (left or right).

I deleted the cookies already and started over.. can't find the fix... can you help?

thanks
p.s. tried IE9 and Firefox... no luck
Reply With Quote
  #6 (permalink)  
Old October 8th, 2012, 02:47 PM
Wrox Author
Points: 412, Level: 7
Points: 412, Level: 7 Points: 412, Level: 7 Points: 412, Level: 7
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Dec 2011
Posts: 57
Thanks: 1
Thanked 19 Times in 19 Posts
Default

Download the code samples for Chapter 8 and see if the final one runs ok. If it does (which it should) compare the code there to what you have for typos etc.
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
uploading/resizing (transparant) images in C# smiter C# 1 February 19th, 2007 08:53 PM
Resizing Images san123 ASP.NET 1.0 and 1.1 Basics 2 April 26th, 2006 02:51 PM
Resizing images according to paper size Taxidriver Crystal Reports 3 March 28th, 2006 06:08 AM
GDI+ - Issue Resizing images Hubman VS.NET 2002/2003 2 April 16th, 2004 08:11 PM
Resizing Images From a Database mayhew3 Pro PHP 1 March 3rd, 2004 07:19 PM



All times are GMT -4. The time now is 03:49 AM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.