Cashew Posted July 4, 2007 Share Posted July 4, 2007 Hello, I have a question about PHP I am looking to do the following I would like it whereas when you upload a image via ftp, this image is automaticlly created into a thumbnail and put within a slice, then when you click that link (slice) from a client point-of-view it loads the full screen image in a java pop up window, Is this possible ? One other thing concerns me though since alot of browsers nowadays can block pop-ups is there a way to force a pop-up dispite the browser has it blocked ? Quote Link to comment https://forums.phpfreaks.com/topic/58459-php-question-newbie-images-and-php/ Share on other sites More sharing options...
Yesideez Posted July 4, 2007 Share Posted July 4, 2007 Forcing pop-ups is frowned upon and I doubt you'll get help with that here, certainly not from me. Yes, everything is possible. I prefer to have most things open in the same window. Quote Link to comment https://forums.phpfreaks.com/topic/58459-php-question-newbie-images-and-php/#findComment-289876 Share on other sites More sharing options...
Cashew Posted July 4, 2007 Author Share Posted July 4, 2007 Well I will think of another way with the pop-up. So the rest is possible how would you go about this ? I know for some of you this may or may not be simple stuff. So this can be all done within HTML? Quote Link to comment https://forums.phpfreaks.com/topic/58459-php-question-newbie-images-and-php/#findComment-289879 Share on other sites More sharing options...
Yesideez Posted July 4, 2007 Share Posted July 4, 2007 You'll definitely need PHP as you'll need to do some scripting or some other like ASP. I've not played with making thumbnails from images but I have written a file manager where users can upload files to the server. For that I used HTML, PHP and for ease of use I had it running with a MySQL database to keep track of the files. I'm sure others will be able to give you more information than this. Very sorry if its a bit vague but its late and I'm soon off to bed! Quote Link to comment https://forums.phpfreaks.com/topic/58459-php-question-newbie-images-and-php/#findComment-289880 Share on other sites More sharing options...
Cashew Posted July 4, 2007 Author Share Posted July 4, 2007 Alright, hopefully someone offers some help. Quote Link to comment https://forums.phpfreaks.com/topic/58459-php-question-newbie-images-and-php/#findComment-289883 Share on other sites More sharing options...
Yesideez Posted July 4, 2007 Share Posted July 4, 2007 What I'd do is look for some sample scripts to upload files and to resize images. Play with them and see how they work then start on writing your own or modifying the existing ones to do what you want. As you go along you'll learn quite a bit and you can always come back here and ask questions if you get stuck. Have fun! Quote Link to comment https://forums.phpfreaks.com/topic/58459-php-question-newbie-images-and-php/#findComment-289889 Share on other sites More sharing options...
nloding Posted July 4, 2007 Share Posted July 4, 2007 And to avoid using a pop-up, but elegantly displaying the full image, Google Lightbox. It's a free javascript app, and it's the best I've seen. Quote Link to comment https://forums.phpfreaks.com/topic/58459-php-question-newbie-images-and-php/#findComment-289900 Share on other sites More sharing options...
Cashew Posted July 4, 2007 Author Share Posted July 4, 2007 Oh alright. Still waiting on some help with the PHP and images. Thank You Quote Link to comment https://forums.phpfreaks.com/topic/58459-php-question-newbie-images-and-php/#findComment-289912 Share on other sites More sharing options...
redarrow Posted July 4, 2007 Share Posted July 4, 2007 1 <?php 2 if(isset($_POST['Submit'])) 3 { 4 $size = 150; // the thumbnail height 5 $filedir = 'pics/'; // the directory for the original image 6 $thumbdir = 'pics/'; // the directory for the thumbnail image 7 $prefix = 'small_'; // the prefix to be added to the original name 8 $maxfile = '2000000'; 9 $mode = '0666'; 10 $userfile_name = $_FILES['image']['name']; 11 $userfile_tmp = $_FILES['image']['tmp_name']; 12 $userfile_size = $_FILES['image']['size']; 13 $userfile_type = $_FILES['image']['type']; 14 if (isset($_FILES['image']['name'])) 15 { 16 $prod_img = $filedir.$userfile_name; 17 $prod_img_thumb = $thumbdir.$prefix.$userfile_name; 18 move_uploaded_file($userfile_tmp, $prod_img); 19 chmod ($prod_img, octdec($mode)); 20 $sizes = getimagesize($prod_img); 21 $aspect_ratio = $sizes[1]/$sizes[0]; 22 if ($sizes[1] <= $size) 23 { 24 $new_width = $sizes[0]; 25 $new_height = $sizes[1]; 26 }else{ 27 $new_height = $size; 28 $new_width = abs($new_height/$aspect_ratio); 29 } 30 $destimg=ImageCreateTrueColor($new_width,$new_height) 31 or die('Problem In Creating image'); 32 $srcimg=ImageCreateFromJPEG($prod_img) 33 or die('Problem In opening Source Image'); 34 if(function_exists('imagecopyresampled')) 35 { 36 imagecopyresampled($destimg,$srcimg,0,0,0,0,$new_width,$new_height,ImageSX($srcimg),ImageSY($srcimg)) 37 or die('Problem In resizing'); 38 }else{ 39 Imagecopyresized($destimg,$srcimg,0,0,0,0,$new_width,$new_height,ImageSX($srcimg),ImageSY($srcimg)) 40 or die('Problem In resizing'); 41 } 42 ImageJPEG($destimg,$prod_img_thumb,90) 43 or die('Problem In saving'); 44 imagedestroy($destimg); 45 } 46 echo ' 47 <a href="'.$prod_img.'"> 48 <img src="'.$prod_img_thumb.'" width="'.$new_width.'" heigt="'.$new_height.'"> 49 </a>'; 50 }else{ 51 echo ' 52 <form method="POST" action="'.$_SERVER['PHP_SELF'].'" enctype="multipart/form-data"> 53 <input type="file" name="image"><p> 54 <input type="Submit" name="Submit" value="Submit"> 55 </form>'; 56 } 57 ?> Quote Link to comment https://forums.phpfreaks.com/topic/58459-php-question-newbie-images-and-php/#findComment-289921 Share on other sites More sharing options...
Cashew Posted July 4, 2007 Author Share Posted July 4, 2007 Oh, thank you. So I just put this in the HTML and put the image file names ? I wanted to use lightbox for the image pop up is that put in that aswell ? I didn't expect this I should try this out. So it creates a thumbnail and put it within a slice ? Then when the slice\link is clicked the java (lightbox) pops up showing this image and this is all automatic all I do is upload the image via ftp and that's it ? Quote Link to comment https://forums.phpfreaks.com/topic/58459-php-question-newbie-images-and-php/#findComment-289943 Share on other sites More sharing options...
Cashew Posted July 5, 2007 Author Share Posted July 5, 2007 Hi If someone could answer my question about the following PHP script, question is below. Quote Link to comment https://forums.phpfreaks.com/topic/58459-php-question-newbie-images-and-php/#findComment-290318 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.