Jump to content

unplugged_web

Members
  • Posts

    897
  • Joined

  • Last visited

Everything posted by unplugged_web

  1. Thank you that's great, but can I ask how I get the customer value for just one person depending on what their initial value is? Also I can't change how the script is printed at all.
  2. Unfortunately I have no control over how the script is printed at all. I just have a url that I need to get the information from.
  3. Sorry I wasn't very clear, it's a string. When I open the console there's nothing to expand. This is exactly what I get: They're sorted by Name, Initial Value, Total Amount. I need to get the Total Amount depending on what the Name are Initial Values are. So for example I want to Total Amount of Jo when the Initial Value is 0.50, but not when it's 0
  4. When I go to the url that returns that, that's exactly what I get. I can't give the url though as it's password protected
  5. I've got a function called currentValues() that gives the information I need in the following format [Name, Initial Value, Total Amount]. An example of what I get is: var currents="[Jo,0,1250.21][ian,10,2555.11][Fred,2,186.36][sue,0.30,1157.56]"; function currentValues() { $("#currentinfo").html(current s); } But I don't know how to get it so that I can display just the Total Amount of say Jo. I don't even know where to start so would be grateful for any pointers.
  6. I've cracked it - I just created a page that stored the embedded code and then called that in the link instead
  7. I've been working on a rebuild for a while, but am stuck on loading embedded video. It worked on the old site, but I don't know how to get it to work on the new site. All of the embedded code is stored in a database and I'm trying to load it when somebody clicks a thumbnail. The code that worked on the old site was this: <script type="text/javascript">jQuery(document).ready(function($) {$("#gallery #videos #loader").empty().html('<img src="/css/loader.gif" alt="" />')$('#gallery #videos').load($('ul.thumbs li a:first').attr('href')); $('.thumb').click(function(e){$("#gallery #videos #loader").empty().html('<img src="/css/loader.gif" alt="" />')$('#gallery #videos').load($(this).attr('href'));e.preventDefault();}); });</script> but as the old site used Cake I don't know how to change this so that it works.The entire code I have is this: <div class="video view"><div id="thumbs" class="navigation"><ul class="thumbs noscript"><?php include 'includes/db.php'; ?><?php$con = mysql_connect($host,$username,$password);if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db($database, $con);$result = mysql_query("SELECT images.foreign_id, images.filename, videos.embed_code, videos.title, videos.order, videos.artist_id, artists.first_name, artists.last_name, artists.slug as artslug, videos.slug as videoslugFROM images, videos, artistsWHERE videos.artist_id = $id AND images.foreign_id = videos.id AND artists.id = $id AND images.class = 'Video'GROUP BY images.filenameORDER BY videos.order ASC");while($row = mysql_fetch_array($result)){echo "<li><a href=\"/video.php?id=$id&video={$row['videoslug']}\" class=\"thumb\"><img src=\"/uploads/image/filename/thumb/thumbnailbig/". $row['filename'] . "\" alt=\"{$row['first_name']} {$row['last_name']} {$row['title']}\" title=\"{$row['first_name']} {$row['last_name']} {$row['title']}\" /></a></li>";}mysql_close($con);?></ul></div><div id="gallery" class="content"><div id="videos"><div id="loader"></div></div> </div></div> <script type="text/javascript">jQuery(document).ready(function($) {$("#gallery #videos #loader").empty().html('<img src="/css/loader.gif" alt="" />')$('#gallery #videos').load($('ul.thumbs li a:first').attr('href')); $('.thumb').click(function(e){$("#gallery #videos #loader").empty().html('<img src="/css/loader.gif" alt="" />')$('#gallery #videos').load($(this).attr('href'));e.preventDefault();}); }); It loads the first video, but when I click to load a new video it just reloaded the first one. I'd be grateful for any help as I'm not sure how to fix this and the client is on my back to get this fixed. Thanks in advance
  8. Just in case anybody else gets stuck with this, I changed the code to below: <?phpinclude '../includes/db.php'; $images[] = $_POST['images'];$i = 0;if(!empty($images[0])){foreach($images as $value) {foreach($value as $row){$i++;if($row != 'tHeader'){$con = mysql_connect($host,$username,$password);if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db($database, $con);mysql_query("UPDATE `images` SET `order`='$i' WHERE `id`='$row'");mysql_close($con);}}}}?> and it now works perfectly.
  9. I'm using to check the results. This is the entire code I'm using for the drag and drop:<script language="Javascript">$(document).ready(function() { // Initialise the table$('#images').tableDnD({onDragClass: "drag",onDrop: function(table, row) { alert($.tableDnD.serialize()); $.ajax({type: "POST",url: "http:/www.domain.com/new_site/admin/ajaxtest.php",data: "" + $.tableDnD.serialize(),success: function(html){}});}});}); </script>
  10. Post should be the variables from each row. If I move a row then the " alert($.tableDnD.serialize());" line brings up a dialog box with the new order. This is what the dialog box shows:
  11. Images is the table id, each row in the table has it's own id (which corresponds to the id in the database), I'm trying to automatically update the order after somebody has changed it.
  12. I've found this drag and drop script and it's brilliant but I can't seem to get it to update the results in the database. I've got this on the page: <script language="Javascript">$(document).ready(function() { // Initialise the table$('#images').tableDnD({onDragClass: "drag",onDrop: function(table, row) { alert($.tableDnD.serialize());$.ajax({type: "POST",url: "http:/www.domain.com/new_site/admin/ajaxtest.php",data: "" + $.tableDnD.serialize(),success: function(html){}});}});}); </script> the alert box does give the correct values, but when I call the ajaxtest.php page nothing happens.The ajaxtest.php page has this: <?phpinclude '../includes/db.php';$images[] = $_POST['images'];$i = 0;if(!empty($images[0])){foreach($images as $value) {foreach($value as $row){$i++;if($row != 'tHeader'){$this->Image->set('id', $row);$this->Image->set('order', $i);$this->Image->save();}}}}$con = mysql_connect($host,$username,$password);if (!$con) { die('Could not connect: ' . mysql_error()); }mysql_select_db($database, $con);$sql= sprintf("UPDATE `images` SET `order`='$i' WHERE `id`='$row'");if (!mysql_query($sql,$con))mysql_close($con)?> I'm pretty sure the problem is with the $images[] = $_POST['images']; but of code, but I'm not sure exactly where.
  13. Sorry I think I just had a dumb moment, of course it is!
  14. Brilliant thank you, I copied the script from the website so I must have missed that. It now works where it creates a thumbnail of what ever I select! Fantastic. One question though the image source says the url instead of the filename. How do I change that name and save it to a folder? Thanks for your help.
  15. Yep it's definitely a jpeg, I just checked the file info and it says it's a Adobe Photoshop jpeg. I'm not sure what you mean about wrong IDs though
  16. Yep it's all correct, but I just get a black image :(If I remove the first part of the path I get this error: but if I have the full path then the image is just black rather than showing the part of the image I've tried to crop
  17. I tried using the same filename as the image itself, but I had to use the full path for it because I got errors otherwise. Oops, I didn't notice that, I've removed that but it's still not working. If it helps I've switched on errors but none are shown. I wondered if it was something to do with the gd library but the site has just been moved to a server with the latest version so I guess that's not it?
  18. I came across this image crop script which is great and looks like it does exactly what I want it to do, but I'm having a lot of problems getting it to work. I've searched for a solution and although other people are having the same problem nobody seems to have a solution so I'd be grateful for any help please. I can select the area I want to 'crop' but when I click the Crop Image button I just get black thumbnail. I've checked I've got the most up-to-date version of jquery as well as the jcrop script. This is the code I've got: <?phpsession_start();if (!empty ($_SESSION['loggedin']) ) {$_SERVER['PHP_SELF'];} else { header("location: index.php");}/*** Jcrop image cropping plugin for jQuery* Example cropping script* @copyright 2008-2009 Kelly Hallman* More info: http://deepliquid.com/content/Jcrop_Implementation_Theory.html*/ if ($_SERVER['REQUEST_METHOD'] == 'POST'){$targ_w = $targ_h = 100;$jpeg_quality = 100; $src = $_POST['filename'];$img_r = imagecreatefromjpeg($src);$dst_r = ImageCreateTrueColor( $targ_w, $targ_h ); imagecopyresampled($dst_r,$img_r,0,0,$_POST['x'],$_POST['y'],$targ_w,$targ_h,$_POST['w'],$_POST['h']); // header('Content-type: image/jpeg');imagejpeg($dst_r,null,$jpeg_quality); exit;} // If not a POST request, display page below: ?> ...... <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title><?php echo $title; ?></title><meta name="description" content="<?php echo $description; ?>" /><meta name="keywords" content="<?php echo $keywords; ?>" /><base href="<?php echo $base_url; ?>/"><link rel="stylesheet" type="text/css" href="../new_site/css/admin.css" /><link rel="stylesheet" href="../new_site/css/jquery.Jcrop.css" type="text/css" /><script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script><script src="../new_site/js/jquery.Jcrop.js"></script><script type="text/javascript"><script language="Javascript">// Remember to invoke within jQuery(window).load(...)// If you don't, Jcrop may not initialize properlyjQuery(window).load(function(){ jQuery('#cropbox').Jcrop({boxWidth: 700,boxHeight: 700,onSelect: updateCoords,aspectRatio: 1, bgOpacity: 0.2, bgColor: 'black', }); }); function updateCoords(c){$('#CropX').val(c.x);$('#CropY').val(c.y);$('#CropW').val(c.w);$('#CropH').val(c.h);};</script></head><body><div id="container"><div class="artists index"><div id="homepage_thumbs"><div style="float: left; margin-right: 25px; height: 750px;"><img src="/uploads/image/filename/<?php echo $filename ?>" alt="<?php echo $title ?>" id="cropbox" title="<?php echo $title ?>" style="border: 1px solid #CCCCCC;"/></div><input value="Update Image" type="submit" /></form> <!-- This is the form that our event handler fills --><form action="new_site/admin/thumbnail_test.php?id=<?php echo $image_id ?>" method="post" onsubmit="return checkCoords();"><input name="filename" type="hidden" value="/home/user/domain.com/app/webroot/uploads/image/filename/<?php echo $filename ?>"/><input type="hidden" id="x" name="x" /><input type="hidden" id="y" name="y" /><input type="hidden" id="w" name="w" /><input type="hidden" id="h" name="h" /><input type="submit" value="Create Thumbnail" /></form><form method="post" name="delete_Image" style="margin-left: 25px;"><input type="button" onclick="confirmation()" value="Delete Image"></form><br /><br /></div></div> </div> </div> </body></html>
  19. Thanks that's exactly what I want to do, except I want it to be saved to the server rather than the desktop.
  20. That sounds like what I'm after, do you know of any examples/tutorials? I don't really know how to do that myself without any help.Thanks
  21. This might not be the place to ask this, but from my understand of the GD library I can do this with PHP. What I want to do is have an image on a page that somebody can select a square area of (any size) and after click to say it's okay that area is saved to the server. If the selected area isn't right then they can move it around or select a different area altogether. I've no idea how to do this and wondered if anybody could help please. I've attached a couple of screen grabs to hopefully show better what I mean.
  22. I did try checking mysql_error() but it didn't give me any errors at all
  23. thank you, I tried that and it worked! Thanks
  24. I can't change the field name unfortunately, is there another way if do this if that's the problem?
  25. I tried it without the ORDER BY and it works, as soon as I add that it stops working
×
×
  • Create New...