|
Dear god somebody please help!php:<?php echo "test"; $im = createfromjpeg('../images/test.jpg'); if (!$im) { die ('Unable to open image'); } echo "Image Opened"; ?> test Fatal error:Call to undefined function createfromjpeg() at line whatever GD Version 2.0.34 is installed, with jpeg support. Anyone have any ideas? Once I get this poo poo worked out I can actually start this project
|
# ¿ Mar 25, 2008 18:59 |
|
|
# ¿ Apr 29, 2024 17:46 |
|
Hey, whatdya know, I'm an idiot. Thanks!
|
# ¿ Mar 25, 2008 19:22 |
|
I'm back, this time header() is giving me hell()php:<?php header('Content-type: image/jpeg');?> <html> <body> <?php //functions.inc contains displayPictureTable() include("functions.inc"); //displayPictureTable works correctly up until picture output displayPictureTable(sheds, gable); ?> </body> </html> My function displayPictureTable() works as it should as this all currently sits. It outputs my two test echos, and then attempts to output the picture I have designated but instead of pretty colors, I only get gibberish: code:
1) No header(), gibberish. 2) Put header() in the wrong spot, error message and gibberish 3) [Where I am now] I have header() in what I believed to be the correct location, am getting no error messages (E_ALL), but I'm still not getting a picture. I'm certain this is another stupid mistake (hopefully) common amongst those of us new to php, but I just can't pinpoint what the hell is going wrong here
|
# ¿ Mar 31, 2008 20:31 |
|
duz posted:You can't send headers after outputting content. True, but getting rid of my "html nonsense" changes nothing as well: php:<?php header('Content-type: image/jpeg'); include("functions.inc"); displayPictureTable(sheds, gable); ?>
|
# ¿ Mar 31, 2008 21:11 |
|
fletcher posted:What exactly does displayPictureTable spit out? You can't output any text or html with that header set. Oh dear god I think I'm hosed, as the function name suggests, this is supposed to be outputting a picture table and it's loaded with required html. Is there any way to mix html and php to output a table of pictures? I'd like to avoid iterating through the directory to display them as html pictures, as I need the displayed pictures to be thumbnail links to fullsize pictures. Something like this would work, but be a complete and total pain in the rear end: php:<? $directory = opendir($picPath); while($fileName = readdir($directory)) { $dirArray[] = $fileName; } //Here display $picPath/thumbs/$dirArray[1,2,...n] as links to $picPath/$dirArray[1,2,...n] ?> This is going to suck.
|
# ¿ Mar 31, 2008 21:29 |
|
fletcher posted:
But that's what I am trying to avoid, having seperate thumbnails. Here's the ultimate goal: 1) A potential customer comes to our website, and is interested in a Shed, Deck, or Gazebo, and would like to see some of our recent projects. 2) They somehow navigate to the "Sheds" section of recent projects, and want to see, for example, Gable style sheds that we have built. 3) Some time before this, someone has put a whole bunch of pictures into ./images/sheds/gable 4) On recentprojects/sheds/gable.php (Or whatever it may be, I don't care) this potential customer will see a table (looks aside, that's not my job) of thumbnails for every picture in ./images/sheds/gable/ 5) Each thumbnail is a link to a full size picture opening in a new window. 6) And then we somehow get another building to stand upright (Call it a gazebo), photograph it, throw it into ./images/gazebos and it's a new addition to recentprojects/gazebos.php (Just sitting there pretty at the end of the line, nothing fancy) I can do this all day long (and in fact did, as proof of concept) with seperate directories for thumbs and full size images, but thats just not the way I'd like to go if at all possible. edit: I just re-read your post. Are you suggesting the code do these steps:? 1) Get list of filenames in, for example, ./images/decks 2) Check if $dirArray[0] exists in ./images/decks, output with html if YES 3) If NO, create thumbnail, save. Output with html. 4) repeat. That makes sense to me, but I'm not sure how to use gd to actually create a new *.jpg int he event of a missing thumbnail. Foolio882 fucked around with this message at 21:54 on Mar 31, 2008 |
# ¿ Mar 31, 2008 21:50 |
|
fletcher posted:You can use width and height on the <img> tag (which is a horrible way to do it) otherwise you are going to have to create separate thumbnails. Why is that such a bad solution if it's done automatically? If it can be done automatically, I'm all for it and that will work just fine and dandy. I just did a bit of quick googling and found some very relevant information, and hopefully this will all come together nicely. (Read: I'll be back later with more awful questions, but you all have been very helpful and I do appreciate it!)
|
# ¿ Mar 31, 2008 22:14 |
|
|
# ¿ Apr 29, 2024 17:46 |
|
admiraldennis posted:Yeah, this is all pretty basic knowledge stuff. What can I say, I'm new to this stuff And yes, it all made sense to me, mostly. Would using GET and that makeThumb.php script you suggested work just as well for the one time "Oops, we don't have a thumbnail!" moments? The one part of your post I didn't fully comprehend was "a simple 404 redirection could point to a thumbnail generation script that would fetch the original image ('/img/pic1.jpg'), return the resized one to the browser, and then store the resized one in the thumbs for later use. " I understand the goal there, and think it would work very well, but can you clarify what I've bolded? Is that what you already talked about with the makeThumb.php script?
|
# ¿ Mar 31, 2008 22:24 |