Search Results

Search found 4135 results on 166 pages for 'img'.

Page 6/166 | < Previous Page | 2 3 4 5 6 7 8 9 10 11 12 13  | Next Page >

  • Mouseup not working after mousemove on img

    - by leyou
    I'm trying to do a simple drag script. The idea is to save the position when the mouse is down, update the view while the mouse is moving, and stop when mouse is up. Problem, mouseup event isn't working properly. See the code: var target = $('a') var pos = 0; var dragging = false; $(document).mousedown(function(e) { pos=e.pageX; dragging = true }) $(document).mouseup(function() { dragging = false }) $(document).mousemove(function(e) { if(dragging){ target.css('left', e.pageX-pos); } }) ? Why mouseup works with a "a" tag: http://jsfiddle.net/leyou/c3TrG/1/ And why mouseup doesn't work with a "img" tag: http://jsfiddle.net/leyou/eNwzv/ Just try to drag them horizontally. Same probleme on ie9, ff and chrome.

    Read the article

  • jquery animating different img widths

    - by romeozor
    Hi there, I've been searching for an answer for a long time with no avail, so it's time to ask. I'm trying to use .animate() to change the size of an image once clicked. The first state of the image would be a thumbnail size, which would animate to the image's original size, then to a thumbnail again. The problem is, not all the images have the same "original" size so I need a way to tell one generic function to switch to the current image's original size. This is my current code which loads on $(window).load: $('img[class=resize]').click(function (){ if ($(this).width() != 150) { $(this).animate({width: '150px'}, 400); } else { $(this).animate({width: ''}, 400); } }); Now this obviously doesn't work the way I want it, because .animate() thinks when I say width: '' I want to make the width = 0. Any suggestions how I should go about this?

    Read the article

  • problem in showing an img open from zip archive

    - by moustafa
    iam get the img date from the zip archive by getFromIndex() and the date like that (this the first line of text appearing) ‰PNG ??? IHDR???@???@???ªi know how i can makke appear iam used $im = imagecreatefromstring($data); if ($im !== false) { header('Content-Type: image/png'); imagepng($im); imagedestroy($im); } but its did not worked and used header('Content-Type: image/png'); imagepng($data); imagedestroy($im); but its did not worked and giving me Warning: imagepng(): supplied argument is not a valid Image resource

    Read the article

  • HTML img scaling

    - by rwallace
    I'm trying to display some large images with HTML img tags. At the moment they go off the edge of the screen; how can I scale them to stay within the browser window? Or in the likely event that this is not possible, is it possible to at least say "display this image at 50% of its normal width and height"? The width and height attributes distort the image -- as far as I can tell, this is because they refer to whatever attributes the container may end up with, which will be unrelated to the image. I can't specify pixels because I have to deal with a large collection of images each with a different pixel size. Max-width doesn't work.

    Read the article

  • Javascript code for serial img loading

    - by Surfer
    Hi everyone, I am new to javascript. I want a javascript code with which i can load an image which is named for every day/month/year. in a serial i have the following code : var year = new Array(); year = ["08", "09", "10", "11"]; var month = new Array(); month = ["JAN", "FEB", "MAR", "APR", "MAY", "JUN", "JULY", "AUG", "SEP", "OCT", "NOV", "DEC"]; var date = new Array(); date = ["01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31"]; var ims = ""; for (var x in year) { for (var y in month) { for (var z in date) { ims += "<im src=screencover/img/" + date[z] + "" + month[y] + "20" + year[0] + ".png>"; } } } document.write(ims);

    Read the article

  • jQuery catch img

    - by Happy
    We have a script used for each .item: $(".item").each(function(){ item_link = "http://..."; block = $('.block', this); $.get(item_link, function(data) { var src = $('img.slide', data).attr('src'); block.html(src); }); }); item_link variable is uniquie for each query. There can be 100 .item or more. The problem is - server has limit on connections at the same time, that why some .item get var src, some not. The best solution is to use just one .get at the same time. I think there should be some counter, if .get is finished - it gives message "I'm finished, you can start" to the next .get and so on. How to do that? Thanks.

    Read the article

  • placing image as div background

    - by Lucka
    How can I place only an image in a div as background image, and add url link to it. Currenty I'm doing it this way: <div class="image"><a href="example.com"><img src="books.png" alt="Test" /></a></div> I want to do something like following, but its not working (the image does not appear). <div class="image"><a href="example.com"><span class="books"></span></a></div> Thanks.

    Read the article

  • Creating a multi-column rollover image gallery with HTML 5

    - by nikolaosk
    I know it has been a while since I blogged about HTML 5. I have two posts in this blog about HTML 5. You can find them here and here.I am creating a small content website (only text,images and a contact form) for a friend of mine.He wanted to create a rollover gallery.The whole concept is that we have some small thumbnails on a page, the user hovers over them and they appear enlarged on a designated container/placeholder on a page. I am trying not to use Javascript scripts when I am using effects on a web page and this is what I will be doing in this post.  Well some people will say that HTML 5 is not supported in all browsers. That is true but most of the modern browsers support most of its recommendations. For people who still use IE6 some hacks must be devised.Well to be totally honest I cannot understand why anyone at this day and time is using IE 6.0.That really is beyond me.Well, the point of having a web browser is to be able to ENJOY the great experience that the WE? offers today.  Two very nice sites that show you what features and specifications are implemented by various browsers and their versions are http://caniuse.com/ and http://html5test.com/. At this times Chrome seems to support most of HTML 5 specifications.Another excellent way to find out if the browser supports HTML 5 and CSS 3 features is to use the Javascript lightweight library Modernizr.In this hands-on example I will be using Expression Web 4.0.This application is not a free application. You can use any HTML editor you like.You can use Visual Studio 2012 Express edition. You can download it here. In order to be absolutely clear this is not (and could not be ) a detailed tutorial on HTML 5. There are other great resources for that.Navigate to the excellent interactive tutorials of W3School.Another excellent resource is HTML 5 Doctor.For the people who are not convinced yet that they should invest time and resources on becoming experts on HTML 5 I should point out that HTML 5 websites will be ranked higher than others. Search engines will be able to locate better the content of our site and its relevance/importance since it is using semantic tags. Let's move now to the actual hands-on example. In this case (since I am mad Liverpool supporter) I will create a rollover image gallery of Liverpool F.C legends. I create a folder in my desktop. I name it Liverpool Gallery.Then I create two subfolders in it, large-images (I place the large images in there) and thumbs (I place the small images in there).Then I create an empty .html file called LiverpoolLegends.html and an empty .css file called style.css.Please have a look at the HTML Markup that I typed in my fancy editor package below<!doctype html><html lang="en"><head><title>Liverpool Legends Gallery</title><meta charset="utf-8"><link rel="stylesheet" type="text/css" href="style.css"></head><body><header><h1>A page dedicated to Liverpool Legends</h1><h2>Do hover over the images with the mouse to see the full picture</h2></header><ul id="column1"><li><a href="http://weblogs.asp.net/controlpanel/blogs/posteditor.aspx?SelectedNavItem=Posts§ionid=1153&postid=8927200#"><img src="thumbs/john-barnes.jpg" alt=""><img class="large" src="large-images/john-barnes-large.jpg" alt=""></a></li><li><a href="http://weblogs.asp.net/controlpanel/blogs/posteditor.aspx?SelectedNavItem=Posts§ionid=1153&postid=8927200#"><img src="thumbs/ian-rush.jpg" alt=""><img class="large" src="large-images/ian-rush-large.jpg" alt=""></a></li><li><a href="http://weblogs.asp.net/controlpanel/blogs/posteditor.aspx?SelectedNavItem=Posts§ionid=1153&postid=8927200#"><img src="thumbs/graeme-souness.jpg" alt=""><img class="large" src="large-images/graeme-souness-large.jpg" alt=""></a></li></ul><ul id="column2"><li><a href="http://weblogs.asp.net/controlpanel/blogs/posteditor.aspx?SelectedNavItem=Posts§ionid=1153&postid=8927200#"><img src="thumbs/steven-gerrard.jpg" alt=""><img class="large" src="large-images/steven-gerrard-large.jpg" alt=""></a></li><li><a href="http://weblogs.asp.net/controlpanel/blogs/posteditor.aspx?SelectedNavItem=Posts§ionid=1153&postid=8927200#"><img src="thumbs/kenny-dalglish.jpg" alt=""><img class="large" src="large-images/kenny-dalglish-large.jpg" alt=""></a></li><li><a href="http://weblogs.asp.net/controlpanel/blogs/posteditor.aspx?SelectedNavItem=Posts§ionid=1153&postid=8927200#"><img src="thumbs/robbie-fowler.jpg" alt=""><img class="large" src="large-images/robbie-fowler-large.jpg" alt=""></a></li></ul><ul id="column3"><li><a href="http://weblogs.asp.net/controlpanel/blogs/posteditor.aspx?SelectedNavItem=Posts§ionid=1153&postid=8927200#"><img src="thumbs/alan-hansen.jpg" alt=""><img class="large" src="large-images/alan-hansen-large.jpg" alt=""></a></li><li><a href="http://weblogs.asp.net/controlpanel/blogs/posteditor.aspx?SelectedNavItem=Posts§ionid=1153&postid=8927200#"><img src="thumbs/michael-owen.jpg" alt=""><img class="large" src="large-images/michael-owen-large.jpg" alt=""></a></li></ul></body></html> It is very easy to follow the markup. Please have a look at the new doctype and the new semantic tag <header>. I have 3 columns and I place my images in there.There is a class called "large".I will use this class in my CSS code to hide the large image when the mouse is not on (hover) an image Make sure you validate your HTML 5 page in the validator found hereHave a look at the CSS code below that makes it all happen.img { border:none;}#column1 { position: absolute; top: 30; left: 100; }li { margin: 15px; list-style-type:none;}#column1 a img.large {  position: absolute; top: 0; left:700px; visibility: hidden;}#column1 a:hover { background: white;}#column1 a:hover img.large { visibility:visible;}#column2 { position: absolute; top: 30; left: 195px; }li { margin: 5px; list-style-type:none;}#column2 a img.large { position: absolute; top: 0; left:510px; margin-left:0; visibility: hidden;}#column2 a:hover { background: white;}#column2 a:hover img.large { visibility:visible;}#column3 { position: absolute; top: 30; left: 400px; width:108px;}li { margin: 5px; list-style-type:none;}#column3 a img.large { width: 260px; height:260px; position: absolute; top: 0; left:315px; margin-left:0; visibility: hidden;}#column3 a:hover { background: white;}#column3 a:hover img.large { visibility:visible;}?n the first line of the CSS code I set the images to have no border.Then I place the first column in the page and then remove the bullets from the list elements.Then I use the large CSS class to create a position for the large image and hide it.Finally when the hover event takes place I make the image visible.I repeat the process for the next two columns. I have tested the page with IE 10 and the latest versions of Opera,Chrome and Firefox.Feel free to style your HTML 5 gallery any way you want through the magic of CSS.I did not bother adding background colors and borders because that was beyond the scope of this post. Hope it helps!!!!

    Read the article

  • webcam refreshing image in iframe not working IE

    - by Nix
    I'm trying to show images from this webcam http://regacam.usz.ch/cgi-bin/guestimage.html on an html page by putting an iframe in pointing to another page that has an image tag in it. But it isn't working in IE (I just see a little cross where the image should be), Firefox is ok. Here the page with the image in: <html> <head> <meta http-euqiv="refresh" content="5"> </head> <body> <img src="http://regacam.usz.ch/cgi-bin/faststream.jpg?stream=full&fps=0.01667&rand=295543" width="200" height="150"/> </body> <html> and the iframe: <div id="rightcontainer"> <iframe id="rightframe" src="zurich.html" name="content" frameborder="0"></iframe> </div> I tried a different webcam elsewhere and that works ok in both browsers. Is there something odd about the one in my example? I got the link in src by right-clicking and copying the image location - is that the right way to go about it?

    Read the article

  • My images aren't updating immediately upon changing their src in javascript

    - by Dale
    I'm using the function below to change the img src. It's an array of ten images. When going through the loop, using break points, the images don't all update on the page immediately. Some of them do. If I inspect the unchanged images on the page (while paused at a breakpoint), the src has changed, but the image hasn't changed yet. All of the unchanged images get updated correctly when the function ends. Anyone know why they don't all get updated instantly and how I can force them to update? Also, is there a way I can hold off the updates of all of them until they're all reassigned and thus have them all update on the "simultaneously"? Here's my function. function mainFunction(){ finalSet = calculateSet(); for ( var int = 0; int < finalSet.length; int++) { var fileName = "cardImg" + (int); document.getElementById(fileName).src = "images/cards/" + finalSet[int].name + ".jpg"; } } Thanks for the help. Dale

    Read the article

  • html in do_GET() method of a simple Python webserver

    - by Meeri_Peeri
    I am relatively new to Python but have been doing a lot of different things with it recently and I am liking it a lot. However, I ran into trouble/block with the following code. import http.server import socketserver import glob import random class Server(http.server.SimpleHTTPRequestHandler): def do_GET(self): self.send_response(200, 'OK') self.send_header('Content-type', 'html') self.end_headers() self.wfile.write(bytes("<html> <head><title> Hello World </title> </head> <body>", 'UTF-8')) images = glob.glob('*.jpg') rand = random.randint(0,len(images)-1) imagestring = "<img src = \"" + images[rand] + "\" height = 1028 width = 786 align = \"right\"/> </body> </html>" self.wfile.write(bytes(imagestring, 'UTF-8')) def serve_forever(port): socketserver.TCPServer(('', port), Server).serve_forever() if __name__ == "__main__": Server.serve_forever(8000) What I am trying to do here is grab a random image from multiple images in the directory and add it into the response to a web request. The code works fine but when I access the server via browser, the image is not displayed. The html of the page is as intended though. The permissions on the files are 755. Also I tried to create an index.html file in the do_GET method. That didn't work either. I mean the index.html was generated fine, but the response in the browser this time did not show anything (not even the hello world in the title). Am I missing anything very simple here? I was thinking should I overload the handle_request of the underlying SocketServer.BaseServer as the documentation says you should never override BaseHTTPServer's handle() method and should rather override the corresponding do_* method?

    Read the article

  • images not showing up in tab body on class change in IE

    - by user347352
    I can't get any images to show up when I'm using IE with these makeshift tabs I made, everything shows up and space is allocated for the image but the image doesn't show up when I change the class. I'm using the css property visiblity to make it work. function findJournalId(d){ var parent=jQuery(d).parent(); while(!parent.hasClass("journal-content-article")) { parent=parent.parent(); } var parentID=parent.attr("id"); var ret="#"+parentID.replace(/(:|\.)/g,"\\$1"); return ret; };/*]]>*/ </script> </head> <body> <div class="journal-content-article" id="article_66742_350610_1.0"> <ul id="newsTabs"> <li class="tab"> <a class="1">first tab</a> </li> <li class="tab"> <a class="2">second tab</a> </li> <li class="tab"> <a class="3">third tab</a> </li> </ul> <div class="news 1"> This is the first portlet <img width="200px" src="banner head.jpg" /> </div> <div class="news 2"> what up 2 </div> <div class="news 3"> hello 3 </div>

    Read the article

  • Remove .img css from prepended div

    - by Ivan Schrecklich
    OK as the title says I've got a div which is prepended and dynamically loaded. The problem I have is that I can't split the css on this one as it parses also whole strings. The usage is like that: I've got a @username somewhere in the string. If the user hovers it a div with informations will get prepended to the current username. Now there is the problem that I've allowed users to post images in this text also. As the autolinker is flexible it doesn't know the image sizes and restrictions and I want to leave it like that! So I define css classes which look like that: .minpost img{ max-height: 30px; max-width: 30px; } Of course I don't need to mention that this attribute is also inherited by the prepended div. And that I don't want to! nifty little tricks like !important won't work for me. So I am asking you guys. If you need further informations just ask?!

    Read the article

  • jquery mouse events masked by img in IE8 - all other platforms/browsers work fine

    - by Bruce
    Using the jQuery mouse events for mouseenter, mouseleave or hover all work swimmingly on all Mac or Windows browsers except for IE8/Windows. I am using mouseenter and mouseleave to test for hot rectangles (absolutely positioned and dimensioned divs that have no content) over an image used as hotspots to make visible the navigation buttons when different regions of the main enclosing rectangle (image) are touched by the cursor. Windows/IE jQuery never sends notifications (mouseenter our mouseleave) as the cursor enters or exits one of the target divs. If I turn off the visibility of the image everything works as expected (like it does in every other browser), so the image is effectively blocking all messages (the intention was for the image to be a background and all the divs float above it, where they can be clicked on). I understand that there's a z-index gotcha (so explicitly specifying z-index for each absolute positioned div does not work), but unclear as to how to nest or order multiple divs to allow a single set of jQuery rules to support all browsers. The image tag seems to trump all other divs and always appear in front of them... BTW: I could not use i m g as a tag in this text so it is spelled image in the following, so the input editor does not think that I am trying to pull a fast one on stackoverflow... How used? "mainview" is the background image, "zoneleft" and "zoneright" are the active areas where when the cursor enters the nav buttons "leftarrow" and rightarrow" are supposed to appear. Javascript $("div#zoneleft").bind("mouseenter",function () // enters left zone see left arrow { arrowVisibility("left"); document.getElementById("leftarrow").style.display="block"; }).bind("mouseleave",function () { document.getElementById("leftarrow").style.visibility="hidden"; document.getElementById("rightarrow").style.visibility="hidden"; }); HTML <div id="zoneleft" style="position:absolute; top:44px; left:0px; width:355px; height:372px; z-index:40;"> <div id="leftarrow" style="position:absolute; top:158px; left:0px; z-index:50;"><img src="images/newleft.png" width="59" height="56"/></div></div> <div id="zoneright" style="position:absolute; top:44px; left:355px; width:355px; height:372px; z-index:40;"> <div id="rightarrow" style="position:absolute; top:158px; left:296px; z-index:50;"> (tag named changed so that I could include it here) <image src="images/newright.png" width="59" height="56" /></div></div> </div><!-- navbuttons --> <image id="mainview" style="z-index:-1;" src="images/projectPhotos/photo1.jpg" width:710px; height:372px; /> (tag named changed so that I could include it here) </div><!--photo-->

    Read the article

  • flex and bison: wrong output

    - by user2972227
    I am doing a homework using flex and bison to make a complex number calculator. But my program cannot give a correct output. .lex file: %option noyywrap %{ #include<stdio.h> #include<stdlib.h> #include "complex_cal.h" #define YYSTYPE complex #include "complex_cal.tab.h" void RmWs(char* str); %} /* Add your Flex definitions here */ /* Some definitions are already provided to you*/ ws [ \t]+ digits [0-9] number (0|[1-9]+{digits}*)\.?{digits}* im [i] complexnum {ws}*[-]*{ws}*{number}{ws}*[+|-]{ws}*{number}{ws}*{im}{ws}* op [-+*/()] %% {complexnum} {RmWs(yytext); sscanf(yytext,"%lf %lf",&(yylval.real),&(yylval.img)); return CNUMBER;} {ws} /**/ {op} return *yytext; %% /* function provided to student to remove */ /* all the whitespaces from a string. */ void RmWs(char* str){ int i=0,j=0; char temp[strlen(str)+1]; strcpy(temp,str); while (temp[i]!='\0'){ while (temp[i]==' '){i++;} str[j]=temp[i]; i++; j++; } str[j]='\0'; } .y file: %{ #include <stdio.h> #include <stdlib.h> #include "complex_cal.h" /* prototypes of the provided functions */ complex complex_add (complex, complex); complex complex_sub (complex, complex); complex complex_mul (complex, complex); complex complex_div (complex, complex); /* prototypes of the provided functions */ int yylex(void); int yyerror(const char*); %} %token CNUMBER %left '+' '-' %left '*' '/' %nonassoc '(' ')' %% /* start: Add your grammar rules and actions here */ complexexp: complexexp '+' complexexpmultidiv {$$=complex_add($1, $3);} | complexexp '-' complexexpmultidiv {$$=complex_sub($1, $3);} | complexexpmultidiv {$$.real=$1.real;$$.img=$1.img;} ; complexexpmultidiv: complexexpmultidiv '*' complexsimple {$$=complex_mul($1, $3);} | complexexpmultidiv '/' complexsimple {$$=complex_div($1, $3);} | complexsimple {$$.real=$1.real;$$.img=$1.img;} ; complexsimple: '(' complexexp ')' {$$.real=$2.real;$$.img=$2.img;} | '(' CNUMBER ')' {$$.real=$2.real;$$.img=$2.img;} ; /* end: Add your grammar rules and actions here */ %% int main(){ return yyparse(); } int yyerror(const char* s){ printf("%s\n", s); return 0; } /* function provided to do complex addition */ /* input : complex numbers c1, c2 */ /* output: nothing */ /* side effect : none */ /* return value: result of addition in c3 */ complex complex_add (complex c1, complex c2){ /* c1 + c2 */ complex c3; c3.real = c1.real + c2.real; c3.img = c1.img + c2.img; return c3; } /* function provided to do complex subtraction */ /* input : complex numbers c1, c2 */ /* output: nothing */ /* side effect : none */ /* return value: result of subtraction in c3 */ complex complex_sub (complex c1, complex c2){ /* c1 - c2 */ complex c3; c3.real = c1.real - c2.real; c3.img = c1.img - c2.img; return c3; } /* function provided to do complex multiplication */ /* input : complex numbers c1, c2 */ /* output: nothing */ /* side effect : none */ /* return value: result of multiplication in c3 */ complex complex_mul (complex c1, complex c2){ /* c1 * c2 */ complex c3; c3.real = c1.real*c2.real - c1.img*c2.img; c3.img = c1.img*c2.real + c1.real*c2.img; return c3; } /* function provided to do complex division */ /* input : complex numbers c1, c2 */ /* output: nothing */ /* side effect : none */ /* return value: result of c1/c2 in c3 */ complex complex_div (complex c1, complex c2){ /* c1 / c2 (i.e. c1 divided by c2 ) */ complex c3; double d; /*divisor calculation using the conjugate of c2*/ d = c2.real*c2.real + c2.img*c2.img; c3.real = (c1.real*c2.real + c1.img*c2.img)/d; c3.img = (c1.img*c2.real - c1.real*c2.img)/d; return c3; } .h file: #include <string.h> /* struct for holding a complex number */ typedef struct { double real; double img; } complex; /* define the return type of FLEX */ #define YYSTYPE complex Script for compiling the file: bison -d -v complex_cal.y flex -ocomplex_cal.lex.yy.c complex_cal.lex gcc -o complex_cal complex_cal.lex.yy.c complex_cal.tab.c ./complex_cal Some correct sample run of the program: input:(5+6i)*(6+1i) output:24.000000+41.000000i input:(7+8i)/(-3-4i)*(5+7i) output:-11.720000-14.040000i input:(7+8i)/((-3-4i)*(5+7i)) output:-0.128108+0.211351i But when I run this program, the program only give an output which is identical to my input. For example, when I input (5+6i)(6+1i), it just gives (5+6i)(6+1i). Even if I input any other things, for example, input "abc" it just gives "abc" and is not syntax error. I don't know where the problem is and I hope to know how to solve it.

    Read the article

  • CSS Sprite techniques, css background or img's clip

    - by Viktor
    Hi, There are two image sprite techniques. The "classic" version uses the background and the background-position css properties. (as it's described here http://www.alistapart.com/articles/sprites) The "second" version uses an image tag and it's clip css property. (http://css-tricks.com/css-sprites-with-inline-images/) My question is that are there advantages of using the "second" version over the "classic" version? thanks and best, Viktor

    Read the article

  • IE7 CSS bug aligning <img> with text in a <ul>

    - by Artem Russakovskii
    I've been banging my ahead on this IE7 bug for the last few days and it's time to resort to the mind of the crowd. I have the following HTML and CSS: http://beerpla.net/for_www/ie7_test/test.html The goal is to have a <ul>, with each <li> containing a small icon and some text. Multiline text would be aligned to itself and not wrap under the image. I've tried using float:left on the image and a bunch of other things, and finally I thought the position:absolute would work for sure but in IE7 I consistently see the text pop off to the next line and get misaligned with the image: This is what I expect it to look like: I even tried to make the div display:inline which kind of worked but then started wrapping under the image for long lines, so it was no good. zoom:1 also produced a similar effect. I'm at a loss at the moment. This code works fine in all other browsers. IE7 is a special, very special child. Any ideas? Thank you. Edit: If you have IE8, you can emulate IE7 by pressing F12 and then Alt-7.

    Read the article

  • Django Upload form to S3 img and form validation

    - by citadelgrad
    I'm fairly new to both Django and Python. This is my first time using forms and upload files with django. I can get the uploads and saves to the database to work fine but it fails to valid email or check if the users selected a file to upload. I've spent a lot of time reading documentation trying to figure this out. Thanks! views.py def submit_photo(request): if request.method == 'POST': def store_in_s3(filename, content): conn = S3Connection(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY) bucket = conn.create_bucket(AWS_STORAGE_BUCKET_NAME) mime = mimetypes.guess_type(filename)[0] k = Key(bucket) k.key = filename k.set_metadata("Content-Type", mime) k.set_contents_from_file(content) k.set_acl('public-read') if imghdr.what(request.FILES['image_url']): qw = request.FILES['image_url'] filename = qw.name image = filename content = qw.file url = "http://bpd-public.s3.amazonaws.com/" + image data = {image_url : url, user_email : request.POST['user_email'], user_twittername : request.POST['user_twittername'], user_website : request.POST['user_website'], user_desc : request.POST['user_desc']} s = BeerPhotos(data) if s.is_valid(): #import pdb; pdb.set_trace() s.save() store_in_s3(filename, content) return HttpResponseRedirect(reverse('photos.views.thanks')) return s.errors else: return errors else: form = BeerPhotoForm() return render_to_response('photos/submit_photos.html', locals(),context_instance=RequestContext(request) forms.py class BeerPhotoForm(forms.Form): image_url = forms.ImageField(widget=forms.FileInput, required=True,label='Beer',help_text='Select a image of no more than 2MB.') user_email = forms.EmailField(required=True,help_text='Please type a valid e-mail address.') user_twittername = forms.CharField() user_website = forms.URLField(max_length=128,) user_desc = forms.CharField(required=True,widget=forms.Textarea,label='Description',) template.html <div id="stylized" class="myform"> <form action="." method="post" enctype="multipart/form-data" width="450px"> <h1>Photo Submission</h1> {% for field in form %} {{ field.errors }} {{ field.label_tag }} {{ field }} {% endfor %} <label><span>Click here</span></label> <input type="submit" class="greenbutton" value="Submit your Photo" /> </form> </div>

    Read the article

  • .net c# cannot find img resources when open with exe

    - by okuryazar
    Hello, My exe processes text documents and I want to be able to right click on documents, select open with and point to my exe file. I can double click on my exe and choose a file to process with OpenFileDialog and it works fine. However, when I do open with, I get FileNotFound error. Here is the error log: System.IO.FileNotFoundException: attention.jpg at System.Drawing.Image.FromFile(String filename, Boolean useEmbeddedColorManagement) at System.Drawing.Image.FromFile(String filename) at ImzaDogrulamaUygulamasi.frmCertificate.FillTreeView() in D:\VSS\SOURCE\VS2008\EGA\ImzaDogrulamaUygulamasi\ImzaDogrulamaUygulamasi\frmCertificate.cs:line 76 at ImzaDogrulamaUygulamasi.frmCertificate.Form2_Load(Object sender, EventArgs e) in D:\VSS\SOURCE\VS2008\EGA\ImzaDogrulamaUygulamasi\ImzaDogrulamaUygulamasi\frmCertificate.cs:line 244 at System.Windows.Forms.Form.OnLoad(EventArgs e) at System.Windows.Forms.Form.OnCreateControl() at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible) at System.Windows.Forms.Control.CreateControl() at System.Windows.Forms.Control.WmShowWindow(Message& m) at System.Windows.Forms.Control.WndProc(Message& m) at System.Windows.Forms.ScrollableControl.WndProc(Message& m) at System.Windows.Forms.ContainerControl.WndProc(Message& m) at System.Windows.Forms.Form.WmShowWindow(Message& m) at System.Windows.Forms.Form.WndProc(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m) and this is how I add my images in my code, all resources are in the same directory with the exe file: ImageList myImageList = new ImageList(); myImageList.Images.Add(Image.FromFile("attention.jpg")); myImageList.Images.Add(Image.FromFile("sandglass.jpg")); myImageList.Images.Add(Image.FromFile("11.JPG")); myImageList.Images.Add(Image.FromFile("checkGif.jpg")); treeView1.ImageList = myImageList; Any help is much appreciated. Thanks

    Read the article

  • How do I rotate an image in Javascript or CSS

    - by Eric
    I am creating a simple game. I want to use jQUERY to rotate the joints making it move. I am using .animate ( http://api.jquery.com/animate/ ) to animate CSS properties but if it is also possible to use Javscript, I can make my own custom code. More TO-THE-POINT How do I rotate images in CSS or Javascript? I prefer CSS but Javascript is fine too. If it is impossible (which I am pretty sure it is but I am not giving up yet) is there any other possible way to do what i am trying to do without making a bunch of seperate images, each rotated a different way. Or can anyone at least give me an example of a site that does something similar. EDIT: I need 1 CSS property (no -something: rotation(500deg);) that works with FireFox, Safari and Chrome because those are the only browsers I really work with.

    Read the article

  • convert HTML to PDF with dynamic image using PD4ML

    - by vishwanath
    We are using PD4ML library to convert HTML to PDF. Is there any way with which I can include a image from the internet in my HTML to convert it into PDF. I am having problem in getting the image into PDF. I tried using base parameter in the PD4ML library but that didn't worked out. May be I am doing something wrong or PD4ML doesn't support including image from the internet. Because when I discussed my problem with other colleagues, found out that when we use the image from local server it gets to the PDF but image from internet don't. I am bound to use PD4ML, so solution with PD4ML only will be highly appreciated.

    Read the article

  • CKEditor configuration, prefer img tag atrributes over inline style

    - by Unreason
    On su it was suggested to ask this here... Looking for a way to disable a feature in CKEditor that messes with attributes height and width on my and converts them into inline styles. The version of CKEditor is 3.2 and I have access to config files. Along the same lines is there somewhere an overview (or procedure) for changing the way CKEditor produces html (I'd like to force it to do inline styles; except for images, plus some other changes) Thank you for taking the time to read this

    Read the article

  • Dynamically created image doesn't show when <img>'s src is refreshed to point to it

    - by Obay
    Hello, I have a javascript function generateGraph() { ... jQuery.get('chart.php?month='+month+'&year='+year); document.getElementById('graph').src = 'charts/'+month+'_'+year+'.png'; ... } which is called onChange. It basically creates, if not exists, or refreshes if already exists, a PNG image (using the first line above) and supposedly displays the generated image (using the second line above). The first line works, but the second one doesn't. Meaning, the image is generated, but the second line can't display the image, unless the page is reloaded, or if the image being referred to already existed before the page was loaded (meaning the 1st line just "refreshed" the image) Any ideas as to why this is and how to fix it? Thanks much for your help in advance!

    Read the article

  • Set Image Src to Local File

    - by cmessier
    I am writing a Firefox extension and would like the users to be able to change an image on a web page with a local image. Is it possible, using JavaScript, to change the image source with an image that is saved on the user's local machine? Let me know if you need more information. Thanks

    Read the article

< Previous Page | 2 3 4 5 6 7 8 9 10 11 12 13  | Next Page >