473,943 Members | 28,891 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Picture Gallery which rezises images

Hello!

I tested several picture galleries now but I didn't find anyone I like.

It should be very simple (just login and upload) but it should be able
to rezise pictures. You specify a value for the max height and max width
and depending if the hight or width is more the picture will be rezised
so that it fits into the gallery thumnails even if it was taken 90°
rotated.

Is there such a script available somewhere?
Jul 27 '05 #1
2 2341
I noticed that Message-ID:
<42************ ***********@new sreader.inode.a t> from Martin Brunner
contained the following:
It should be very simple (just login and upload) but it should be able
to rezise pictures. You specify a value for the max height and max width
and depending if the hight or width is more the picture will be rezised
so that it fits into the gallery thumnails even if it was taken 90°
rotated.

Is there such a script available somewhere?


Not a gallery script, but my upload script does what you want

<?php

$path = "images/main/";
$thumbpath = "images/thumb/";
$thumbnail_widt h=50;
$mainpath="imag es/main/";
$main_width=450 ;
$max_size = 2000000;
$filename="";
if (!empty($_FILES['userfile'])) {

if (is_uploaded_fi le($_FILES['userfile']['tmp_name'])) {

if ($_FILES['userfile']['size']>$max_size)
{ echo "The file is too big<br>\n"; exit; }

if($_FILES['userfile']['type']=="image/gif"){
$createfunction ="imagecreatefr omgif";}
else{$createfun ction="imagecre atefromjpeg";}

if (($_FILES['userfile']['type']=="image/gif") ||
($_FILES['userfile']['type'])=="image/pjpeg" ||
($_FILES['userfile']['type']=="image/jpeg")) {

//check if file already uploaded
//if (file_exists($t humbpath ."s_".
$_FILES['userfile']['name'])) { echo "The file already exists<br>\n";
exit; }

//make a copy of original file
//$res = copy($_FILES['userfile']['tmp_name'], $path .
//$_FILES['userfile']['name']);

//create thumbnail image
$src_img = $createfunction ($_FILES['userfile']['tmp_name']);
$new_w = $thumbnail_widt h;
$new_h = imagesy($src_im g)/(imagesx($src_i mg)/$new_w);
$dst_img = imagecreatetrue color($new_w,$n ew_h);
imagecopyresamp led($dst_img, $src_img, 0, 0, 0, 0, $new_w,
$new_h, imagesx($src_im g), imagesy($src_im g));
imagejpeg($dst_ img, $thumbpath
.."s_".$_FILE S['userfile']['name'], 100);

//create big image
if(imagesx($src _img)>450){
$new_w = $main_width;
$new_h = imagesy($src_im g)/(imagesx($src_i mg)/$new_w);
$dst_img = imagecreatetrue color($new_w,$n ew_h);
$res=imagecopyr esampled($dst_i mg, $src_img, 0, 0, 0, 0,
$new_w, $new_h, imagesx($src_im g), imagesy($src_im g));
imagejpeg($dst_ img, $path ."b_".
$_FILES['userfile']['name'], 50);
$notify = "Main image resampled";
}
else{
$res = copy($_FILES['userfile']['tmp_name'], $path
.."b_".
$_FILES['userfile']['name']);
$notify = "Main image not resampled";
}

if (!$res) { echo "<h2>Upload failed!</h2><br>\n"; exit;
}
else { echo "<h2>Upload sucessful!</h2>\n";
}

$filename=$_FIL ES['userfile']['name'];
printf("<strong >Main :
</strong>%sb_%s<b r>\n",$path,$fi lename);
printf("<strong >Thumbnail :
</strong>%ss_%s<b r>\n",$thumbpat h, $filename);

echo "Original File Size:
".$_FILES['userfile']['size']." bytes<br>\n";
echo "File Type: ".$_FILES['userfile']['type']."<br>\n";
echo "$notify.<br>\n ";
}

else { echo "<span class=\"indent1 0bold\">Please use a
..jpg or a .gif file</span><br>\n"; exit; }

printf("<span class=\"indent1 0bold\">Image Thumbnail:
</span><br><br><s pan class=\"indent1 0bold\"><img
src=\"%ss_%s\"a lt=\"%s\"></span><br>",$thu mbpath,$filenam e,$_POST['alt_text']);
imagedestroy($s rc_img);
imagedestroy($d st_img);
}
//end of image upload

//variables for insertion into product table
$thumb_url="s_" .$filename;
$main_url="b_". $filename;

}

?>
--
Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/
Jul 27 '05 #2
JDS
On Wed, 27 Jul 2005 18:42:38 +0200, Martin Brunner wrote:
I tested several picture galleries now but I didn't find anyone I like.


http://gallery.menalto.com

--
JDS | je*****@example .invalid
| http://www.newtnotes.com
DJMBS | http://newtnotes.com/doctor-jeff-master-brainsurgeon/

Jul 27 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
2592
by: Simone Winkler | last post by:
Hello, I don't know if my question is out of topic...so I apologize if I am. I use the coppermine picture gallery for my web (actually I want to use it but the server doesn't seem to have GD running but I will beg them to activate it). How can I actually find out if GD is installed? I tried to use phpinfo() and I searched for a GD entry, but no one was there, so can I be sure, that GD isn't installed? (Because the admins of the...
2
3943
by: matt | last post by:
I have compiled some code, some written by me, some compiled from various sources online, and basically i've got a very simple flat file photo gallery. An upload form, to upload the photos and give them a caption, storing the caption and filename in a text file. It's a bit buggy when removing the photos and captions from the file, and also in displaying them on the delete page. you can see it in action at www.4am.com.au/gallery/upload.php...
54
7295
by: Max Quordlepleen | last post by:
Apologies for the crossposting, I wasn't sure which of these groups to ask this in. I have been lurking in these groups for a week or so, trying to glean what I need to design a simple, clean set of pages that get the w3c tick for XHTML 1.0 Strict, and CSS2. So far, I have succeeded, thanks to the great information in these groups. Now, however, I'm having trouble. A few days ago, I read a thread that dealt with this issue of...
6
2022
by: VB Programmer | last post by:
I am creating an online, interactive, art gallery using ASP.NET. I want the user to be able to select (1) a frame type & size, (2) a matte type & color and (3) a picture. I will then display what it would look like together and they can purchase it online. It's kind of like an interactive framining page. What do you suggest is the best way to dynamically switch these looks? There could be literally hundreds of combinations.
13
3299
by: Jim Carlock | last post by:
I have over a hundred pictures I would like to present. Is it practical to create and parse an array of pictures, picture paths, et al using server-side scripting to accomplish this? I created an array already, and whereby, the HTML and Javascript currently used amount to about 14KB for each of four different pages, the PHP page I started working on is already over 35KB in size (most of it is server side processing creating the array...
11
2801
by: ste | last post by:
Hi there, Further to my recent posts where I've received excellent help from Rik and Jerry, I've ended up with an image gallery on my website that displays images in a table, 3 images per row. This works great and opens all images in the database when I open the url mywebsite/gallery.php, or I can choose certain images (by category) by going to url's like mywebsite/gallery.php?category=landscape Although the above worked perfectly...
0
4209
by: numbnutz | last post by:
Hi, I am currently working on an XML Gallery for my girlfriend's brother who is a photographer. I have created a flash front end template and am using an XML database to load the images and accompanying captions. The gallery has more than one image and the user can navigate the gallery by clicking forward and backward buttons to take then through the images: var galleryXML = new XML(); galleryXML.ignoreWhite = true;...
5
2131
by: dabhand | last post by:
Hi This page http://www.dabhand.co.nz/ayupdev/gallery-riders.html works great in IE but not in Firefox... any help would be appreciated. It refers to an external javascript file which I have included the code to below: The file name is imgriders.js - as referred to in source of the html file above. if (document.images) { image1 = new Image; image2 = new Image; image3 = new Image;
1
1401
by: chadmathbiz | last post by:
Hello, and nice to meet all of you: My name's Chad, and I have a head-bashing problem. I built out a photo gallery with very specific mouseover/onclick etc. behaviors. It works fine in Firefox. (The code is embarassingly un-elegant, please forgive a newbie!) Here's a URL: http://www.carlygaebe.com/pictures_polaroid_02.html#_self (all the relevant Java is in the document) Features: - thumbnail mouseover images - thumbnail onclick...
0
9970
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
11534
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
11299
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10662
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9865
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6087
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
6308
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4910
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3511
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.