Jump to content

Search the Community

Showing results for tags 'images'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

  1. I'm trying to display some user created content on a page. Everything does what it should except the image (it's always the image). To be clear, I'm not storing the image in the DB only the link to the image, but images are being uploaded into the site file system. The path being stored in the DB (phpmyadmin) is the full image path - /opt/lampp/htdocs/site/news/img/posts/* - The image doesn't display on the page and I get a 404 not found in the console. When I echo the path to the page that it's looking for the image in, it's as above. But the 404 not found in the console says it's looking for it at http://localhost/opt/lampp/htdocs.... So it's obviously got a redundant section (http://localhost). When I try to remove the /opt/lampp/htdocs from the upload path I get a bunch of warnings. But the real issue is that the browser is adding the repeated section. So how do I remedy this so the browser looks in the correct location? TIA
  2. Good Morning, Freaks, I hope you're all well. I've a question - I've been researching coding image resize functionality. While looking into the functions I'd need to do this I came across very similar code used in examples from 3 different sources so decided this was good code to learn from. So I tweeked it a bit and put it into a class method -> public function imageResize($target, $newcopy, $w, $h, $ext) { list($orig_w, $orig_h) = getimagesize($target); $scale_ratio = $orig_w/$orig_h; if(($w / $h) > $scale_ratio) { $w = $h * $scale_ratio; } else { $h = $w / $scale_ratio; } $img = ""; if($ext == "gif" || $ext == "GIF") { $img = imagecreatefromgif($target); } else if($ext == "png" || $ext == "PNG") { $img = imagecreatefrompng($target); } else if($ext == "jpg" || $ext == "JPG" || $ext == "jpeg" || $ext == "JPEG") { $img = imagecreatefromjpeg($target); } $create_tci = imagecreatetruecolor($w, $h); imagecopyresampled($create_tci, $img, 0, 0, 0, 0, $w, $h, $orig_w, $orig_h); imagejpeg($create_tci, $newcopy, 80); } and then connected it to a button -> <?php require("assets/initializations.php"); if(isset($_POST['upload_image'])) { $image_obj = new Image($conn, $user); $image_obj->imageUpload(); } else if(isset($_POST['resize_image'])) { mysqli_report(MYSQLI_REPORT_ERROR|MYSQLI_REPORT_STRICT); $image_obj = new Image($conn, $user); $kaboom = explode(".", $image_name); //object params $image_ext = $kaboom[-1]; $target_image = "/opt/lampp/htdocs/site/admin/img/$image_name"; $resized_image = "/opt/lampp/htdocs/site/admin/img/resized_$image_name"; $max_w = 150; $max_h = 150; $image_obj->imageResize($target_image, $resized_image, $max_w, $max_h, $image_ext); //header("Location: add_photo.php"); } ?> Setup: A preview button chooses the image, a preview which is displayed underneath it (using js). There's also an upload button to bring it into the sites file system. This functionality works fine. I've just added the resize button beside the preview button and connected the object method to it. Intended Result: The resize button resizes the previewed image and the resized image is now previewed instead of the original image. Result: Nothing. The button stays in the active state, but nothing happens. I get no warning nor error messages and absolutely nothing in dev tools to work from. Not sure what my next step would be outside asking more experienced coders Any advise or guidance on getting this resolved would be met with appreciation. TIA
  3. Hi I have a script for displaying images see below <?php include "header.php"; require 'gallery/Gallery.php'; ?> <?php $models=file("models.txt", FILE_USE_INCLUDE_PATH); if(isset($_POST['model'])){ $model=($_POST['model']); } $gallery = new Gallery(); $gallery->setPath('gallery/images/'.$model); $images = $gallery->getImages(array('jpg')); ?> <div class="container"> <?php if($images): ?> <div class=gallery cf > <?php foreach($images as $image):?> <div class="gallery-item"> <a href="<?php echo $image['full'];?>"><img src="<?php echo $image['thumb']; ?>"> </div> <?php endforeach; ?> </div> <?php else: ?> There are no images <?php endif; ?> </div> <div class="form"> <form action="index.php" method="POST"> <select name="model" class="select_box" data-placeholder="Select Model" style= width:120px;/> <option></option> <?php foreach($models as $mod):?> <option><?php echo $mod ?></option> <?php endforeach;?> </select> <input type="submit" Value="Select" value="Select"> </form> </div> <script type="text/javascript"> $(".select_box").chosen(); </script> The above code works , i get no errors this images array is populated at this line "$images = $gallery->getImages(array('jpg'));" but they do no show in the container class. When I run this script all the css shows borders and the like. bet there are no images didplayed. However it does work if I replace the code in the container class with this $images = "gallery/images/".$model; $files = scandir($images); unset($files[0], $files[1]); $rows = array_chunk($files, 6); foreach ($rows as $row){ foreach ($row as $image){ echo '<td><a href="gallery/images/', $model,'/', $image,'"><img src="gallery/images/',$model,'/thumbs/',$image,'"/></a></td>'; } } Is it possible I have a conflict with the jQuery. I am using the plugin called "chosen" The $models is a text file that populates the drop down box Thank you, your help is very much appreciated
  4. I am using this script for image uploads. https://www.w3schools.com/php/php_file_upload.asp I noticed that with some of the image uploads, I would get the error "Sorry, only JPG, JPEG, PNG & GIF files are allowed." The images i upload are one of the file types listed above. So I am wondering why i would get an error for some images but not others despite all them of being the same file types? Can you tell why judging from the script?
  5. Hi all and Guru Jacques, I have just ported my application on the VM server and the application seems to be working fine except that it does not display the images. The parallel application on my localhost on windows works fine. The two are same except for some changes in the path. I have checked that the paths are correct by using small test files that echo their file names telling me exactly which all paths have been successfully traversed by the app. On logging in, there is a graph which is normally displayed if there is corresponding data for the user. No matter how much I try I am unable to get that graph to print. So i simply placed an image in the folder and tried to invoke that instead but that too to no avail. The corresponding graph and image on the local host on windows works great. No issues there. My error.log and access.log on the VM have no errors recorded in them. They were recording errors just fine when there were a few errors while I was adjusting the path. I got the "unable to find so and so file errors which were successfully recorded. The point is that the application is not giving an errors. Not even the file not found ones. So I guess my path is correct. Here is the structure of the application with some names changed. docroot is the Document Root. aboveroot is a folder outside the root. The code for graph lies in this folder ( aboveroot/images). Since the graph did not display, I added an image here (images) for testing. That did not display either. index.php required invoke.php which invokes graph.php and should display the graph provided the user data exists. ---www |--- docroot |----- index.php |--- aboveroot |----images |-----invoke.php |----graph.php |---- abc.jpg |----test.php I then added a test.php : $file = '21.jpg'; echo '<img src = 21.jpg>'; echo "Found Test"; and called test.php from invoke.php instead of graph.php. While it echoed "Found Test", it did not display the image. The same code in localhost on windows displays the image with test.php and the graph with graph.php when invoked from So I am at a loss and looking for some help. Thanks all !
  6. I have been tasked with attempting to recreate a web app that allows a user to upload a photo and then cut out a specific part of an image that will be saved as a transparent PNG, with the main use being removing backgrounds from an image (i.e. cutting out a face to use as an avatar, etc) I found two online tools that already do this in different ways: 1. Smart Scissors: Quick video shows how you can drop anchor points with your mouse and it will try to auto find the border and "snap to". Pretty slick but doesn't work perfectly when I played with it. And requires a separate "invert" option to handle all scenarios. http://fotoflexer.com/demos.php 2. Clipping Magic: This one is very cool and surprisingly accurate. You basically paint rough green lines over the stuff you want to keep and red lines over the stuff you want to cut out and a live preview lets you see the result. https://clippingmagic.com/tutorials/basics I am not asking for anyone to give me any code whatsoever, just curious, do you think both of these types of things are doable strictly using PHP (using GD and maybe some other custom PHP classes floating around the web)? Are you able to tell what they both use now? Actually looks like Smart Scissors uses Flash, but not sure about Clipping Magic. I ideally would make something more like Clipping Magic. I just don't want to start building in PHP if there are things that some of you smarter people on this site can tell I will never be able to accomplish using solely PHP, even if I was the best PHP developer ever. Any info, direction, advice would be greatly appreciated. Thanks!
  7. Been trying to get these to scale, I got the top image and everything else to scale just not these images. Any help would be greatly appreciated, thanks in advance. http://www.golden-wand.com/members/contact.php <div id="bannerImage"> <div id="bannerImage1"><img src="../Assets/Pictures/Golden Wand/CutOut/Tools.png" width="auto" height="200px" alt="Tools"></div> <div id="bannerImage2"><img src="../Assets/Pictures/Golden Wand/CutOut/Angled Truck.png" width="auto" height="200px" alt="Truck"></div> </div> http://www.golden-wand.com/members/styles.css div#bannerImage {border:solid purple; width:100%; height:222px; display:table; } div#bannerImage1 {border:solid red; position:relative; float:left; margin-top:7px; margin-left:130px; max-height:200px; max-width:40%; display:table-cell; } #bannerImage1 img{ position:relative; max-width:auto; max-height:100%; } div#bannerImage2 {border:solid blue; position:relative; float:left; margin-top:7px; margin-left:150px; max-height:200px; max-width:50%; display:table-cell; } #bannerImage2 img{ position:relative; max-width:auto; max-height:100%; } Here's my link to my text file of ownership: http://www.golden-wand.com/phpfreaks.txt
  8. Hi there, I have a PHP script, which is used to extract id's of uploaded images in a database. I then use id=1 etc tp display the relevent image using Picasso library in an Android App. However my customer will be adding images to the database, which will be auto-incremented by id number, but I want to display the LATEST image ie the highest id number. How do I achieve this in this URL? Here is my code for the file_display.php I want to refresh last 12 images if possible, ie each new entry should be added from id=1 to id=12, but I don't know how to achieve this. That's why I want to obtain LAST ID, and use this in URL below.. THANKs!! <?php include "file_constants.php"; // just so we know it is broken error_reporting(E_ALL); // some basic sanity checks if(isset($_GET['id']) && is_numeric($_GET['id'])) { //connect to the db $link = mysql_connect("$host", "$user", "$pass") or die("Could not connect: " . mysql_error()); // select our database mysql_select_db("$db") or die(mysql_error()); // get the image from the db $sql = "SELECT image FROM test_image WHERE id=" .$_GET['id'] . ";"; // the result of the query $result = mysql_query("$sql") or die("Invalid query: " . mysql_error()); // set the header for the image header("Content-type: image/jpeg"); echo mysql_result($result, 0); // close the db link mysql_close($link); } else { echo 'Please use a real id number'; } ?> AND URL inside Android app: "http://padihamcars.com/file_display.php?id=1"
  9. I'm looking to replace a select dropdown with images. My current code for the drop down is <div class="app_services_dropdown_select"> <select name="app_select_services" class="app_select_services"> <option value="1" selected="selected">Class IV MOT (Up to 3,000KG)</option> <option value="2">Class VII MOT (3,000KG - 3,500KG)</option></select> <input type="button" class="app_services_button" value="Show available times"> </div> Which is generated by this code: $s .= '<div class="app_services">'; $s .= '<div class="app_services_dropdown">'; $s .= '<div class="app_services_dropdown_title">'; $s .= $select; $s .= '</div>'; $s .= '<div class="app_services_dropdown_select">'; $s .= '<select name="app_select_services" class="app_select_services">'; if ( $services ) { foreach ( $services as $service ) { $service_description = ''; // Check if this is the first service, so it would be displayed by default if ( $service->ID == $appointments->service ) { $d = ''; $sel = ' selected="selected"'; } else { $d = ' style="display:none"'; $sel = ''; } // Add options $s .= '<option value="'.$service->ID.'"'.$sel.'>'. stripslashes( $service->name ) . '</option>'; } } $s .= '</select>'; $s .= '<input type="button" class="app_services_button" value="'.$show.'">'; $s .= '</div>'; $s .= '</div>'; And I really want an image of a car as value 1 and a van as value 2, plus I really want it to submit on click rather than having the button. Is it possible to replace the dropdown with images instead or would I need to use a radio button, then style it using an image? You can see my current dropdown in use here
  10. First off, I am very new to php and I am learning the best I can. I am trying to display a dynamic grid style table within a loop and display my mysql data inside of it. The data is a Image URL, directory URL, URL description, and it prints all this data as an image with a link to the gallery. The code works fine as... 5 wide x 5 down. It's supposed to look a little something like this: [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] Now that works, however when I change my rows and column variable # to 7 and 7 is when the problems start.. Here is my main code for this function: //define variables $uniqhash = ""; $modelname = ""; $email = ""; $galleryurl = ""; $gallerydesc = ""; $category = ""; $datesubmitted = ""; $gallerythumb = ""; $rows = 0; $count = 0; $columns = 0; $select = "SELECT * From `models`"; $images_rows = mysqli_query($conn, $select); $images = array(); if( empty( $images ) ) { echo 'Sorry, there was a fatal error in selecting images from database.'; } while ($image = mysqli_fetch_assoc($images_rows)) { $images[] = $image; } echo '<table align="center" border="0"><tr>'; $size = sizeOf($images) - 1; //get count of array and put into $size foreach($images as $image){ if($rows == 7) { echo '</tr><tr>'; // if our count is x wide, start a new row $rows = 0; } if ($columns == 7){ echo '</tr><tr>'; $columns = 0; } echo "<td><a href=" . $image['galleryurl'] . " target=\"new\"><img src=" . $image['gallerythumb'] . " height=\"160\" width=\"160\" alt=\"" . $image['gallerydesc'] . "\"></a></td>"; $rows++; $count++; $columns++; echo ($rows == 7 && $columns == 5 && $count != $size) ? '</tr>': ''; } echo '</tr></center></table>'; When I change $rows and $columns to 7 each it will display images like: (sample of 13 images) [] [] [] [] [] [] [] [] [] [] [] [] [] [] I would like it to print x images across for $rows and x amount of rows for $columns in a grid like fashion. If anyone can give me some help on this I would appreciate it...I have been desperately reading up on loops trying to figure it out but so far no luck. P.S I am familiar with sanitizing all my data and that I need to implement this but I want to make sure my code functions first.
  11. So, I currently have a script (in beta mode, only works when the sun shines), that can upload an image and store directly in a mysql database (using the BLOB data type); the script is also able to retrieve the BLOB data and display them vertically on the page; I actually need to dsiplay them horizontally across the page instead. So currently the retrieved images are printed in this format: 1 2 3 4 5 6 7 8 and I need it to print this way: 1 2 3 4 5 6 7 8 sounds like a for loop somewhere... any takers on how to implement the feature?
  12. If you search for images on Google images, you will see how they setup their images, side by side and have infinity scroll. I don't care about the infinity scroll part, but I am interested in how they set up the images? My plan is to retrive the images from the database and use pagination numbers.
  13. Hi I echo out images from a folder. The problem is that I have a html file in the same folder but I don't want to echo that out. How can I write my code to get rid of the html in the output? Here my code: <?php $filetype = '*.html'; $dirname = substr('$filetype'); $i=0; if (isset($_POST['submit2'])) { //get the dir from POST $selected_dir = $_POST['myDirs']; //now get the files from within the selected dir and echo them to the screen foreach(glob($selected_dir . DIRECTORY_SEPARATOR . '*') as $dirname) { echo substr($dirname, 0, -4); echo '<img src="'.$dirname.'" />'; echo "<label><div class=\"radiobt\"><input type='radio' name='radio1' value='$i'/></div></label>"; } } ?> P.S. when I echo out : substr($dirname, 0, -4); I want to get ride of the html filename there too. How can I do so something like this?
  14. I have this script from http://lampload.com/component/option,com_jdownloads/Itemid,382/cid,69/task,view.download/ (I am not using a database) I can upload images fine, I can view files, but I want to delete them. When I press the delete button, nothing happens http://www.jayg.co.uk/gallery6/upload_gallery.php <form> <?php $dir = dirname(__FILENAME__)."/images/gallery" ; $files1 = scandir($dir); foreach($files1 as $file){ if(strlen($file) >=3){ $foil = strstr($file, 'jpg'); // As of PHP 5.3.0 $foil = $file; $pos = strpos($file, 'css'); if ($foil==true){ echo '<input type="checkbox" name="filenames[]" value="'.$foil.'" />'; echo "<img width='130' height='38' src='images/gallery/$file' /><br/>"; // for live host //echo "<img width='130' height='38' src='/ABOOK/SORTING/gallery-dynamic/images/gallery/ $file' /><br/>"; } } }?> <input type="submit" name="mysubmit2" value="Delete"> </form> any ideas please? thanks
  15. I built a CMS system using CKEditor and KCFinder that store information od a databse via textarea/php. So far so good! The issue comes to when I want to store and display images that link to themselves. The way I am storing images is exactly the same: There is a textarea where I insert an image via KCFinder/CKEditor. The image is uploaded to the server and the path stored at the database. Later I try to pick up that path from the database to display the image and because I want the image to link to itself, I try to use the same method to insert the url on the link. Problem? The link is missing and the images are not displaying. Can anyone point me the error and suggest any solution? I would be so thankful! CODE: try { $DBH = new PDO('mysql:host=localhost;dbname=yourdb;charset=utf8', 'user', 'password'); $DBH->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $STH = $DBH->prepare('SELECT * FROM php_maskiner ORDER BY timestamp DESC'); $STH->execute(); $STH->setFetchMode(PDO::FETCH_OBJ); while($row = $STH->fetch()) { $title = $row->title; $entry = $row->entry; $images = $row->images; $img_url = $row->images; $img_pack = '<div class="mask3 span3"> <a rel="prettyPhoto" href="'.$img_url.'"><img src="'.$images.'"></a> </div>'; } $DBH = null; } catch (PDOException $e) { echo '<div class="alert alert-standard fade in"> <a class="close" data-dismiss="alert" href="#">×</a> <strong>Can\'t read the database!</strong> </div><br />'.$e; } <?php echo '<article class="span12 post"> '.$img_pack.' <div class="inside"> <div class="span8 entry-content"> <div class="span12"> <h2>'.$title.'</h2> <p>'.$entry.'</p> </div> </div> </div> </article>'; ?> Thanks in advance!
  16. I have tried everything I can think of with passthru and imagecreatefrompng and whatnot. I cant copy the file to a web directory, so that is out. I just have to be able to display the image. So, my php script calls a program that creates an image based on user input: $file_name = "/site.com/public/www/prod/data/" . $var1 . "_" . $var2 . "_" . $var3 . PHP_EOL; $image_name = $file_name . "_pic.png"; So the program saves the image, say... /site.com/public/www/prod/data/12_24_36_pic.png And yeah, I can totally see the image there. It looks great. However, The site's web root directory is this: /site.com/public/www/prod/htdocs/ So the image is sitting in a directory above what the browser can see. How can I display that image to people?
  17. It would really help to have an outside view to what I am trying to do. I have 1 users table. 1 posts table and 1 favorites table. Basically what I am trying to do is give a user an option to add other users' posts to their favorites folder. Say these are the options for each table in mysql. users:: - id - username posts:: - post_id - user_id - title - post favorites:: - favorite_id - user_id - post_id Now I know I can use joins to join these tables together. I have tried them for other things and they work. It's just that with this particular case, I am having some issues getting the query right. This is my query. Please point out what's wrong with it and how to do it correctly. $stmt = $dbh->prepare("SELECT users.*, posts.*, favorites.* FROM posts LEFT JOIN users ON records.user_id = users.id LEFT JOIN favorites ON posts.user_id = favorites.id WHERE posts.user_id = {$userid} ORDER BY posted DESC LIMIT 4"); ps. $userid is definied outside of this query, so don't worry about it.
  18. Hi Guys I am in the world of trying to prevent copyrighted images being downloaded and have entered the following line into my .htaccess file RewriteRule \.(gif|jpg|js|txt|png)$ /messageforcurious [L] It works in the fact that I cannot enter the image name into the address bar, but it also prevents pages from downloading the images, is it possible to prevent the user downloading the images using .htaccess?
  19. Hi everyone. I am new to PHP and i am trying to upload multiple images using a form. I need to send those images to the admin of the site via mail. Can anyone help me and show me a little demo? Here is the code of form for start <form enctype="multipart/form-data" id='cartform' name='cartform' method='POST' action='<?php echo home_url('/submit-order');?>'> <div> <input name="userimage[]" type="file" multiple accept="image/*"> <input type='submit' name='submit1' value='Proceed'> </div> </form> I need want to get the images on next page and use them as attachment with mail to admin. I am using Wordpress
  20. in first row, i want to display image1, pink block, image2, yellowblock in second row, ...................black block, image3, red block, image4 in third row,........................image4, pink block, image5, yellowblock images are called dynamically using php.. any suggestions plz.. thanks.
  21. Hello PHPer's I am having a few problems with my code. I've probably missed something but could do with an outsiders opinion. Basically, I am writing a bit of code where the user can enter some information and an image into a form and save it to the mysql database. For the most part, the code works, If I don't add the image then the content is all saved. However, when I do add an image I am just given my predefined error message from the code. The php debugger is not much use as the connection is for a local host which is stored on a server and not on my PC.... This is the code: $auth = $_POST['auth']; $tit = $_POST['tit']; $band = $_POST['band']; $alb = $_POST['alname']; $rel = $_POST['release']; $stat = $_POST['stat']; $shrt = $_POST['short']; $art = $_POST['art']; $conn = mysqli_connect("localhost","") or die ("Could not connect to database"); if(!is_uploaded_file($_FILES['file']['tmp_name'])) { $query = "INSERT INTO albumreviews (author,title,band,albumname,releasedate,shortdesc,article,albumdate,status) VALUES ('$auth','$tit','$band','$alb','$rel','$shrt','$art',CURDATE(),'$stat')"; //echo "$naquery"; } else { if ($_FILES['file']['type'] != "image/gif" && $_FILES['file']['type'] != "image/jpeg" && $_FILES['file']['type'] != "image/jpg" && $_FILES['file']['type'] != "image/x-png" && $_FILES['file']['type'] != "image/png") { $query = "INSERT INTO albumreviews (author,title,band,albumname,releasedate,shortdesc,article,albumdate,status) VALUES ('$auth','$tit','$band','$alb','$rel','$shrt','$art',CURDATE(),'$stat')"; //echo "$naquery"; } else { $finame = $_FILES["file"]["name"]; //$ext = end(explode(".", $finame)); $result = move_uploaded_file($_FILES['file']['tmp_name'], "../includes/$finame"); if ($result == 1) { $query = "INSERT INTO albumreviews (author,title,band,albumname,releasedate,shortdesc,article,albumdate,status,image) VALUES ('$auth','$tit','$band','$alb','$rel','$shrt','$art',CURDATE(),'$stat''$finame'))"; //echo "$naquery"; } else { $query = "INSERT INTO albumreviews (author,title,band,albumname,releasedate,shortdesc,article,albumdate,status) VALUES ('$auth','$tit','$band','$alb','$rel','$shrt','$art',CURDATE(),'$stat')"; //echo "$naquery"; } } } $result = mysqli_query($conn, $query); if($result){ echo "successful"; echo "<BR>"; echo "<a href='http://'>Back to Content Management </a>"; } else { echo "error could not upload article"; echo "<BR>"; echo "<a href='http://'>Back to Content Management </a>"; } mysqli_close($conn); ?> Any help on getting this to upload the image files would be much appreciated. Thanks
  22. So i have this code wich checks if my server is online: <?php $ip = "example.com"; //IP or web addy $port = "80"; //Port $sock = @fsockopen( $ip, $port, $num, $error, 2 ); //2 is the ping time, you can sub what you need //Since fsockopen function returns TRUE or FALSE we can just plug it into the IF/THEN statement. An IF/ELSE would have worked to if( !$sock ){ //Do this if it is closed echo( "offline" ); } if( $sock ){ //Do this if it is open echo( "online" ); fclose($sock); } ?> and i've got: <img class="img-circle" src="ico/online.png" alt="Server status"> I want to use the php script to change the image source in the html.I have an online.png and an offline.png image.I need to somehow change it and I don't know how. I am fairly new to php.
  23. Hello. I'm having troubles disabling right click on images. The website shows the message that is supposed to be shown when I perform the right click, but also shows the right click menu (copy, save image as, etc.). What is the problem with this code (I'm not pasting the tags, only the "body" of the code)? var clickmessage="Clique com o botão direito desactivado nas imagens!" function disableclick(e) { if (document.all) { if (event.button==2||event.button==3) { if (event.srcElement.tagName=="IMG"){ alert(clickmessage); return false; } } } else if (document.layers) { if (e.which == 3) { alert(clickmessage); return false; } } else if (document.getElementById){ if (e.which==3&&e.target.tagName=="IMG"){ alert(clickmessage) return false } } } function associateimages(){ for(i=0;i<document.images.length;i++) document.images.onmousedown=disableclick; } if (document.all) document.onmousedown=disableclick else if (document.getElementById) document.onmouseup=disableclick else if (document.layers) associateimages()
  24. Hi, I am trying to check if image exits on some url, if so then display it. This works fine if I have image locally and use file_exists() When i pass url file_exits(), it fails. Any help appreciated.
  25. Hi, I'm not at all savvy with PHP, but I am trying to learn and I would really appreciate some help. Please excuse my limited knowledge and try not to get too annoyed. Here is what I'm looking to achieve: So lets I want my PHP to grab these files and place them on my page 2009-1.jpg 2009-2.jpg 2009-3.jpg 2010-1.jpg 2010-2.jpg 2010-3.jpg 2010-4.jpg 2011-1.jpg 2011-2.jpg 2011-3.jpg Instead of just having all of them appear in one div as they are now (see code below) <?php if($dirHandler = opendir($images_dir)){ while(false !== ($file = readdir($dirHandler))){ $files[] = $file; } } natcasesort($files); foreach($files as $myFile){ $name = explode(".", $myFile); if($myFile != "." && $myFile != ".." && ($name[1] == "jpg" || $name[1] == "JPG" || $name[1] == "jpeg" || $name[1] == "JPEG")){ echo "<div class='thumb'><a href='" . $images_dir . "/" . $myFile . "'><img src='" . $images_dir."/thumb/" . $myFile . "'></a></div>\n"; } } ?> I need divs to be "generated". (To put it very dumbly: If filename contains "2011" then create div class=2012_div and fill with "2011" ".jpg") So from the files above. we would end up with: <div class="2009_div"> <div class='thumb'><a href='_Images/Dates/Jue 25/2009-1.jpg'><img src='_Images/Dates/Jue 25/thumb/2009-1.jpg'></a></div> <div class='thumb'><a href='_Images/Dates/Jue 25/2009-2.jpg'><img src='_Images/Dates/Jue 25/thumb/2009-2.jpg'></a></div> <div class='thumb'><a href='_Images/Dates/Jue 25/2009-3.jpg'><img src='_Images/Dates/Jue 25/thumb/2009-3.jpg'></a></div> </div> <div class="2010_div"> <div class='thumb'><a href='_Images/Dates/Jue 25/2010-1.jpg'><img src='_Images/Dates/Jue 25/thumb/2010-1.jpg'></a></div> <div class='thumb'><a href='_Images/Dates/Jue 25/2010-2.jpg'><img src='_Images/Dates/Jue 25/thumb/2010-2.jpg'></a></div> <div class='thumb'><a href='_Images/Dates/Jue 25/2010-3.jpg'><img src='_Images/Dates/Jue 25/thumb/2010-3.jpg'></a></div> <div class='thumb'><a href='_Images/Dates/Jue 25/2010-4.jpg'><img src='_Images/Dates/Jue 25/thumb/2010-4.jpg'></a></div> </div> <div class="2010_div"> <div class='thumb'><a href='_Images/Dates/Jue 25/2011-1.jpg'><img src='_Images/Dates/Jue 25/thumb/2011-1.jpg'></a></div> <div class='thumb'><a href='_Images/Dates/Jue 25/2011-2.jpg'><img src='_Images/Dates/Jue 25/thumb/2011-2.jpg'></a></div> <div class='thumb'><a href='_Images/Dates/Jue 25/2011-3.jpg'><img src='_Images/Dates/Jue 25/thumb/2011-3.jpg'></a></div> </div> Is this possible? Again, any help much appreciated. Thanks!
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.