the-botman Posted May 11, 2010 Share Posted May 11, 2010 hi guy... ok see i have this code what it does is gives the user an option to upload an image, add text, pick text position and font then pick a frame and click generate, now there are 17 frames to pick from and this floods the mobile users phone and takes very long to load the page, how do i devide this into 3 sub pages or make a drop down menu with the names of the frame and when they pick say frame 2 it must show them what the frame looks like then if they like it they can click generate,here is the code <?php if (isset($_FILES['image_field'])){ $handle = new upload($_FILES['image_field']); if ($handle->uploaded) { if (isset($_POST['image_frame'])) { if ($_POST['image_frame']){ $frame = $_POST['image_frame']; $handle->image_watermark = $frame; $handle->image_watermark_position = 'TL'; } else { $frame = $_FILES['image_field']['tmp_name']; } $frameinfo = getimagesize($frame); $newimg_w = $frameinfo[0]; $newimg_h = $frameinfo[1]; } $filename=explode('.',$_FILES['image_field']['name']); $handle->file_new_name_body = $filename[0]; $handle->file_overwrite = TRUE; $handle->image_x = $newimg_w; $handle->image_y = $newimg_h; $handle->image_ratio_fill = true; $handle->image_resize = true; if ($_POST['image_text']){ $handle->image_text = $_POST['image_text']; $handle->image_text_font = $_POST['text_font']; $handle->image_text_position = $_POST['text_position']; } //header('Content-type: ' . $handle->file_src_mime); //header("Content-Disposition: attachment; filename=".rawurlencode($handle->file_src_name).";"); $handle->process(getcwd().'/output/'); if ($handle->processed) { echo '<div class="hd2"><font color=#666666><strong><center> Your Own Personalized Image</center></strong></font></div>'."\n"; echo '<img alt="" src ="output/'.$handle->file_dst_name.'"><br/><br/>'; echo '<a href="output/'.$handle->file_dst_name.'">Download</a>'; echo '<br>'."\n"; echo ' <tr style="font-color:#85859c;"><td style="width:10px;"><img src="Images/Logos/Logo_Back.gif"></td><td>'."\n"; echo ' <font face="Verdana" size="2"><b><a href="index.php">Back</b></font></a><br>'."\n"; echo '<br>'."\n"; $handle->clean(); } else { echo 'error : ' . $handle->error; } } exit; } ?> <div class="hd2"><font color=#666666><strong><center>Personalize Your Own Image</center></strong></font></div> <form enctype="multipart/form-data" method="post" action="<?php echo $_SERVER['PHP_SELF'];?>"> <table> <tr> <td>Image:</td><td><input type="file" size="32" name="image_field" value=""></td> </tr> <tr> <td>Text:</td><td><input type="text" size="32" name="image_text" value=""></td> </tr> <tr> <td>Font:</td> <td> <select name="text_font"> <option value="3">1</option> <option value="4">2</option> <option value="5">3</option> <option value="fonts/addlg10.gdf" selected="selected">4</option> <option value="fonts/anonymous.gdf">5</option> </select> </td> </tr> <tr> <td>Text Position: </td> <td> <select name="text_position"> <option value=""></option> <option value="TL">Top Left</option> <option value="CL">Middle Left</option> <option value="BL">Bottom Left</option> <option value="TC">Top Center</option> <option value="CC">Middle Center</option> <option value="BC" selected="selected">Bottom Center</option> <option value="TR">Top Right</option> <option value="CR">Middle Right</option> <option value="BR">Bottom Right</option> </select> </td> </tr> <tr> <td colspan="2"> </td> </tr> <tr> <td colspan="2">Choose frame:</td> </tr> <tr> <td><input checked="checked" type="radio" name="image_frame" value="" /></td> <td>None</td> </tr> <tr> <td><input type="radio" name="image_frame" value="frames/frame1.gif" /></td> <td><img src="frames/frame1.gif" alt="" width="100" /></td> </tr> <tr> <td><input type="radio" name="image_frame" value="frames/frame2.gif" /></td> <td><img src="frames/frame2.gif" alt="" width="100" /></td> </tr> <tr> <td><input type="radio" name="image_frame" value="frames/frame3.gif" /></td> <td><img src="frames/frame3.gif" alt="" width="100" /></td> </tr> <tr> <td><input type="radio" name="image_frame" value="frames/frame4.gif" /></td> <td><img src="frames/frame4.gif" alt="" width="100" /></td> </tr> <tr> <td><input type="radio" name="image_frame" value="frames/frame5.gif" /></td> <td><img src="frames/frame5.gif" alt="" width="100" /></td> </tr> <tr> <td><input type="radio" name="image_frame" value="frames/frame6.gif" /></td> <td><img src="frames/frame6.gif" alt="" width="100" /></td> </tr> <tr> <td><input type="radio" name="image_frame" value="frames/frame7.gif" /></td> <td><img src="frames/frame7.gif" alt="" width="100" /></td> </tr> <tr> <td><input type="radio" name="image_frame" value="frames/frame8.gif" /></td> <td><img src="frames/frame8.gif" alt="" width="100" /></td> </tr> <tr> <td><input type="radio" name="image_frame" value="frames/frame9.gif" /></td> <td><img src="frames/frame9.gif" alt="" width="100" /></td> </tr> <tr> <td><input type="radio" name="image_frame" value="frames/frame10.gif" /></td> <td><img src="frames/frame10.gif" alt="" width="100" /></td> </tr> <tr> <td><input type="radio" name="image_frame" value="frames/frame11.gif" /></td> <td><img src="frames/frame11.gif" alt="" width="100" /></td> </tr> <tr> <td><input type="radio" name="image_frame" value="frames/frame12.gif" /></td> <td><img src="frames/frame12.gif" alt="" width="100" /></td> </tr> <tr> <td><input type="radio" name="image_frame" value="frames/frame13.gif" /></td> <td><img src="frames/frame13.gif" alt="" width="100" /></td> </tr> <tr> <td><input type="radio" name="image_frame" value="frames/frame14.gif" /></td> <td><img src="frames/frame14.gif" alt="" width="100" /></td> </tr> <tr> <td><input type="radio" name="image_frame" value="frames/frame15.gif" /></td> <td><img src="frames/frame15.gif" alt="" width="100" /></td> </tr> <tr> <td><input type="radio" name="image_frame" value="frames/frame16.gif" /></td> <td><img src="frames/frame16.gif" alt="" width="100" /></td> </tr> <tr> <td><input type="radio" name="image_frame" value="frames/frame17.gif" /></td> <td><img src="frames/frame17.gif" alt="" width="100" /></td> </tr> <tr> <td><input type="radio" name="image_frame" value="frames/frame18.gif" /></td> <td><img src="frames/frame18.gif" alt="" width="100" /></td> </tr> <tr> <td colspan="2"><input type="submit" name="Submit" value="Generate"></td> </tr> </table> </form> <? echo '<br>'."\n"; echo ' <tr style="font-color:#85859c;"><td style="width:10px;"><img src="Images/Logos/Logo_Back.gif"></td><td>'."\n"; echo ' <font face="Verdana" size="2"><b><a href="../index.php">Back</b></font></a><br>'."\n"; echo ' </td></tr>'."\n"; ?> i been stuck with this for days please help guy Thanks in advance The-Botman Quote Link to comment https://forums.phpfreaks.com/topic/201331-how-do-i-make-sub-pages-with-this-code/ Share on other sites More sharing options...
Adam Posted May 11, 2010 Share Posted May 11, 2010 I'd suggest posting this one in the freelance section, or make your questions a little more specific. Quote Link to comment https://forums.phpfreaks.com/topic/201331-how-do-i-make-sub-pages-with-this-code/#findComment-1056274 Share on other sites More sharing options...
the-botman Posted May 11, 2010 Author Share Posted May 11, 2010 how do i display 5 frames on each page with a next button, what i need is to have 5 frames on each page coz 17 on 1 page is just 2much Quote Link to comment https://forums.phpfreaks.com/topic/201331-how-do-i-make-sub-pages-with-this-code/#findComment-1056277 Share on other sites More sharing options...
Adam Posted May 11, 2010 Share Posted May 11, 2010 By more specific, I meant relating to a particular piece of code or problem. You're pretty much asking someone to do the work for you right now though; which as I said would be better suited to the freelance forum. Quote Link to comment https://forums.phpfreaks.com/topic/201331-how-do-i-make-sub-pages-with-this-code/#findComment-1056292 Share on other sites More sharing options...
the-botman Posted May 11, 2010 Author Share Posted May 11, 2010 how do i split the form up into sub pages just give me an expl to work with Quote Link to comment https://forums.phpfreaks.com/topic/201331-how-do-i-make-sub-pages-with-this-code/#findComment-1056315 Share on other sites More sharing options...
xeross Posted May 11, 2010 Share Posted May 11, 2010 You mean that you have multiple steps, and each step has a part of the form elements that need to be filled ? Quote Link to comment https://forums.phpfreaks.com/topic/201331-how-do-i-make-sub-pages-with-this-code/#findComment-1056323 Share on other sites More sharing options...
the-botman Posted May 11, 2010 Author Share Posted May 11, 2010 yes i just need to split the frames part of the form because it floods the mobile user Quote Link to comment https://forums.phpfreaks.com/topic/201331-how-do-i-make-sub-pages-with-this-code/#findComment-1056327 Share on other sites More sharing options...
the-botman Posted May 11, 2010 Author Share Posted May 11, 2010 anyone? Quote Link to comment https://forums.phpfreaks.com/topic/201331-how-do-i-make-sub-pages-with-this-code/#findComment-1056397 Share on other sites More sharing options...
ignace Posted May 11, 2010 Share Posted May 11, 2010 $step = isset($_GET['step']) ? (int) $_GET['step'] : 1; if (1 === $step) { //code for step #1 //store data in $_SESSION } else if (2 === $step) { //code for step #2 // } In your form you could use: <input type="hidden" name="step" value="1"> Quote Link to comment https://forums.phpfreaks.com/topic/201331-how-do-i-make-sub-pages-with-this-code/#findComment-1056414 Share on other sites More sharing options...
litebearer Posted May 11, 2010 Share Posted May 11, 2010 Rainy morning here. Cold. Caffeine hasn't hit yet. BUT, figured I'd throw out my two cents on the entire thing. You need 7 Pages Page 1 - This is your form page - you need 3 special fields upload_a_ pic - this is the one you already have for getting there picture frame_my_pic - this is a check box it lets you know if they want a frame text_my pic - this is a check box it lets you know if they want to add text ----------------------------------- Page 2 - this is the first script to process your form get all the variables from the form upload and save their picture put all the values in session variables including the name of their picture if frame_my_pic was checked go to Page 3 elseif text_my_pic was checked go to page 5 else go to Page 7 ----------------------------------- Page 3 - this page allows them to select a frame display max of 4 frames using pagination make each frame a clickable link with the frame id as url passed variable link goes to Page 4 ----------------------------------- Page 4 - this page creates the framed image get the url passed frame id get the image name from the SESSION variables get the value of text_my_pic from the SESSION variables create and save the framed image using orignal image name if text_my_pic was checked go to Page 5 else go to Page 7 ----------------------------------- Page 5 - this page gets the text, font desired display form for test_text_desired, font_desired, etc go to Page 6 ----------------------------------- Page 6 - this page adds the text get the values from Page 5 form get image name from SESSIONS variables create the new image saving as origial name go to page 7 ----------------------------------- Page 7 get all the session variables store them in the database do whatever you like - send to page showing the completed image, etc --------------------------------- Quote Link to comment https://forums.phpfreaks.com/topic/201331-how-do-i-make-sub-pages-with-this-code/#findComment-1056463 Share on other sites More sharing options...
xeross Posted May 11, 2010 Share Posted May 11, 2010 $step = isset($_GET['step']) ? (int) $_GET['step'] : 1; if (1 === $step) { //code for step #1 //store data in $_SESSION } else if (2 === $step) { //code for step #2 // } In your form you could use: <input type="hidden" name="step" value="1"> I would use a fall-through switch and save the steps in separate files to maintain some kind of structure. Quote Link to comment https://forums.phpfreaks.com/topic/201331-how-do-i-make-sub-pages-with-this-code/#findComment-1056627 Share on other sites More sharing options...
the-botman Posted May 12, 2010 Author Share Posted May 12, 2010 $step = isset($_GET['step']) ? (int) $_GET['step'] : 1; if (1 === $step) { //code for step #1 //store data in $_SESSION } else if (2 === $step) { //code for step #2 // } In your form you could use: <input type="hidden" name="step" value="1"> I would use a fall-through switch and save the steps in separate files to maintain some kind of structure. and how wold i go about doing that? Quote Link to comment https://forums.phpfreaks.com/topic/201331-how-do-i-make-sub-pages-with-this-code/#findComment-1057101 Share on other sites More sharing options...
xeross Posted May 12, 2010 Share Posted May 12, 2010 $step = isset($_GET['step']) ? (int) $_GET['step'] : 1; // Store data in session here if submit data switch($step) { case 1: case 2: ... require("folder/step_". $step . ".php"); break; } ofcourse you could also use a single if statement like: $step = isset($_GET['step']) ? (int) $_GET['step'] : 1; // Store data in session here if submit data if($step > 0 && $step < 5) require("folder/step_". $step . ".php"); Of course it's your choice what you use but 1 of these 2 might be more organized than the else-if example. Quote Link to comment https://forums.phpfreaks.com/topic/201331-how-do-i-make-sub-pages-with-this-code/#findComment-1057243 Share on other sites More sharing options...
the-botman Posted May 13, 2010 Author Share Posted May 13, 2010 i understand bot the codes but i dont kno how to add it to my code Quote Link to comment https://forums.phpfreaks.com/topic/201331-how-do-i-make-sub-pages-with-this-code/#findComment-1057547 Share on other sites More sharing options...
the-botman Posted May 13, 2010 Author Share Posted May 13, 2010 i understand both the codes, i just dont know how to add them hereor ho they will help Quote Link to comment https://forums.phpfreaks.com/topic/201331-how-do-i-make-sub-pages-with-this-code/#findComment-1057672 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.