Jump to content


New Members
  • Posts

  • Joined

  • Last visited

Argonust's Achievements


Newbie (1/5)



  1. Thank's requinix Sorry but it is print_r($images); shows all the images, that's why I posted the problem here Would'nt I get errors if I was calling the method incorrectley?
  2. 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
  3. Thank you, requinix Installing the GD extention worked Thank you
  4. Hi I have a function $images = $access->getImages(); foreach($files as $file) { $save = 'thumbs/'.$file; create_thumbs($file, "$save" ,150,150); } Here is what it calls function create_thumbs($path,$save,$height,$width){ $info=getimagesize($path); //print_r($info); $size=array($info[0], $info[1]); if($info['mime'] == 'image/jpeg'){ $src=imagecreatefromjpeg($path); }else{ return false; } This code works for me in OpenSuse, however when I move the file to my web server that is CentOS 7 it does not work I get : Fatal error: Call to undefined function imagecreatefromjpeg() Both have php 5 Any help would be greatly appreciated Thank you
  5. Thanks phpmillion Unfortunetley, your recommendation did not work
  6. Hi I am have trouble with making this bit of code work if(!isset($_GET['m'])) { die(); } $model = ($_GET['m']); $images = "thumbs/$model/"; $big = "gallery/$model/"; if($handle=opendir($images)) { while(false!==($file=readdir($handle))) { if($file !=="."&&$file !=".."&&$file !=rtrim($big,"/")) { $files[]=$file; } } closedir($handle); } When I run this code nothing happens. I get this error message PHP Warning: opendir(thumbs/Honda/): failed to open dir: Permission denied in /var/www/html/Cars/index.php on line 56, referer: http://localhost/Cars After some playing around I found that the line $images = "thumbs/$model/"; is the problem. If I change it to $images = "thumbs"; Then it works, my test was done using "print_r($file);" This shows the array in the browser. I have changed all the permissions in the thumbs directory and its sub-directories to 776. This is also the case when using scandir() Any help would be appreciated Thank you
  • 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.