Jump to content

Lassie

Members
  • Posts

    390
  • Joined

  • Last visited

Everything posted by Lassie

  1. I want to save an image with a unique name that is created from a hash function. How can I cretae the path with the variable... $hash=$_GET['hash']; $path ="/Applications/MAMP/htdocs/test_upload/images/imagename2.png"; //becomes $path ="/Applications/MAMP/htdocs/test_upload/images/'.$hash.'.png";?
  2. Lassie

    Gd help

    I still cant save the image. I need it to be automatically saved rather than a forced download as I need the generated image saved to the server and placed in a user refernced. For information this is being developed on a mac. Could you explain what you were intending with the code you posted to read the file please? if ($fd = fopen (Path, "r")) { header("Content-Type: image/PNG"); //header("Content-Disposition: attachment; filename=".$n); //header("Cache-control: private"); while(!feof($fd)) { $buffer = fread($fd, 2048); echo $buffer; } } fclose ($fd); ob_end_flush(); exit; ?>
  3. Lassie

    Gd help

    Thanks - I tried that and i get a broken image.
  4. Lassie

    Gd help

    I tried removing the first header and I still have no image. If I remove the $path I have the image but not saved. Can I add a seperate line to save it ImagePng($image); ImagePng ($image,$path);
  5. Lassie

    Gd help

    Thank you. I can get the image with the text, but when i add the save path the image does not show, just a small question mark in a box. I cant see where this is going wrong. My code is <?php $str2=$_GET['str']; $str=$_GET['str1']; $str3="By"; $path ='http://localhost:8888/test_upload/images/imagename.png'; $image = ImageCreateFromPNG("http://localhost:8888/wordpress_3/wp-content/plugins/Authors2/jackets/GDL.png"); $color = imagecolorallocate($image, 0xFF, 0xFF, 0xFF); $colorShadow = imagecolorallocate($image, 0x66, 0x66, 0x66); $font = 'Tahoma.ttf'; $fontSize = "10"; $fontRotation = "0"; /* Shadow str = title */ ImageTTFText($image, $fontSize, $fontRotation, 27, 22, $colorShadow, $font, $str ); /* Top Level */ ImageTTFText($image, $fontSize, $fontRotation, 25, 20, $color, $font, $str); /*standard narrative*/ ImageTTFText($image, $fontSize, $fontRotation, 25, 60, $color, $font, $str3); ImageTTFText($image, $fontSize, $fontRotation, 25, 100, $color, $font, $str2); header('Content-Disposition: Attachment;filename=imagename.png'); header("Content-Type: image/PNG"); ImagePng ($image,$path); imagedestroy($image); ?> and the img tag is echo "<img src='http://localhost:8888/test_upload/image-save.php?str=$str&str1=$str1'/>"; Any advice appreciated.
  6. Lassie

    Gd help

    Is it possible to both save and display a created image? I can display but not save <?php $str2=$_GET['str']; $str=$_GET['str1']; $str3="By"; $ourFileName = $_SERVER['DOCUMENT_ROOT'] . '/images/test.png'; $image = ImageCreateFromPNG("http://localhost:8888/wordpress_3/wp-content/plugins/Authors2/jackets/GDL.png"); $color = imagecolorallocate($image, 0xFF, 0xFF, 0xFF); $colorShadow = imagecolorallocate($image, 0x66, 0x66, 0x66); $font = 'Tahoma.ttf'; $fontSize = "10"; $fontRotation = "0"; /* Shadow str = title */ ImageTTFText($image, $fontSize, $fontRotation, 27, 22, $colorShadow, $font, $str ); /* Top Level */ ImageTTFText($image, $fontSize, $fontRotation, 25, 20, $color, $font, $str); /*standard narrative*/ ImageTTFText($image, $fontSize, $fontRotation, 25, 60, $color, $font, $str3); ImageTTFText($image, $fontSize, $fontRotation, 25, 100, $color, $font, $str2); header("Content-Type: image/PNG"); ImagePng ($image); imagedestroy($image); ?>
  7. Thank you. That works. I will now develop this a little bit with some more vars and I also need to save the image.
  8. Yes, Sorry I meant in the recieving script.
  9. Thanks for your reply. This gives a very small broken image I'm afraid. Is ther e a way to check the variable is being passed?
  10. I want to build an image with text variables. I can get the image OK but not the text, which I need to pass in an img tag from a form. I have not posted the form here as I know the post field is populated. The static string shows overlayed on the image but not the variable string passed in the query string. Any help appreciated. My code is as follows:- input form <?php if (isset($_POST['submitted'])) { if(isset($_POST['AuthorName'])){ $str=($_POST['AuthorName']); ?><img src="http://localhost:8888/test_upload/text-create2.php?str=' . $str . '"/><?php } } ?> The recieving script <?php $str2=$_GET['$str']; $image = ImageCreateFromPNG("http://localhost:8888/wordpress_3/wp-content/plugins/Authors2/jackets/GDL.png"); $color = imagecolorallocate($image, 0xFF, 0xFF, 0xFF); $colorShadow = imagecolorallocate($image, 0x66, 0x66, 0x66); $font = 'Tahoma.ttf'; $fontSize = "10"; $fontRotation = "0"; $str= "Successful Home Catering"; /* Shadow */ ImageTTFText($image, $fontSize, $fontRotation, 27, 22, $colorShadow, $font, $str ); /* Top Level */ ImageTTFText($image, $fontSize, $fontRotation, 25, 20, $color, $font, $str); ImageTTFText($image, $fontSize, $fontRotation, 25, 100, $color, $font, $str2); header("Content-Type: image/PNG"); ImagePng ($image); imagedestroy($image); ?>
  11. I have a piece of code trying to display a menu with a horintal tabs. I have a parse error at the end of the code at funtion subMenu-3() but I cant see whats wrong with it. Any help appreciated <?php global $wpdb, $wp_version; define('Authors-1',basename(__FILE__)); // create a top-level menu with submenu pages for wordpress admin function author_menus() { // userlevel=8 restrict users to "Administrators" only add_menu_page('Authors-1', 'Authors', 8, Authors-1, 'demo_content'); add_submenu_page(Authors-1, 'SubMenu-1 Title', 'SubMenu-1', 8, '__FILE__', 'author_content'); add_submenu_page(Authors-1, 'SubMenu-2 Title', 'SubMenu-2', 8, '__FILE__', 'author_content'); add_submenu_page(Authors-1, 'SubMenu-3 Title', 'SubMenu-3', 8, '__FILE__', 'subMenu-3'); } //output style and other code for document <head> function author_head() { global $wp_version; if (version_compare($wp_version, '2.7', '>=')) { ?> <style type="text/css"> #demo-menu { display: inline; position: relative; } #demo-menu a, #demo-menu a.link { text-decoration: none; z-index: 1; margin: 0 auto; padding: 0 6px 0 6px; height: 22px; line-height: 22px; font-size: 10px; background-repeat: no-repeat; background-position: right bottom; } .demo-menu-link { float: right; background: transparent url(images/screen-options-left.gif ) no-repeat 0 0; font-family: "Lucida Grande", Verdana, Arial, "Bitstream Vera Sans", sans-serif; height: 22px; padding: 0; margin: 0 6px 0 0; text-decoration: none; text-align:center; } </style> <?php } } // output content for document <body> function author_content() { global $wpdb, $wp_version; if (version_compare($wp_version, '2.7', '>=')) { ?> <ul id="demo-menu"> <li class="demo-menu-link"><a href="?page=Authors-1.php">SubMenu-3</a></li> <li class="demo-menu-link"><a href="?page=demo-page2">SubMenu-2</a></li> <li class="demo-menu-link"><a href="?page=<?php echo DEMOFILE; ?>">SubMenu-1</a></li> </ul> <div style="clear:right;"></div> <?php } ?> <div class="wrap"> <div id="icon-plugins" class="icon32"></div> <h2>Authors Additional Information</h2> <h4>These pages allow you to add additional information to support your book idea or synopsis.<br /> Got to your options page if you want publishers to view this additonal information</h4> <hr/> <?php //output page content for each plugin submenu page if ($_GET['page'] == "Authors-1.php") { } elseif ($_GET['page'] == "demo-page2" ) { print '<p>Demo page 2 content</p>'; } else { //page 1 is default print '<p>Demo page 1 / default content</p>'; echo DEMOFILE; } ?> <hr/> </div> <?php } //end demo_content //function for subMenu-3 function subMenu-3() { echo "submenu-3"; } //incorporate the menu and style into Wordpress admin system add_action('admin_menu', 'author_menus'); //this also adds demo_content add_action('admin_head', 'author_head'); ?>
  12. I have a syntax error on line 53 of this code but I cant see whats wrong with it. <?php //Add my_plugin hook function my_plugin(){ do_action('my_plugin'); } function input_form_handler(){ $form_output=input_form(); return $form_output; } function input_form(){ $form_output="Hello World"; return $form_output; } add_action('my_plugin','input_form_handler'); //add admin panel add_action('admin_menu','my_plugin_admin_actions'); function my_plugin_admin_actions(){ add_options_page('Author Data Edit','Author Data Edit',1,); } ?>
  13. I am using wordpress to develop a site. I have some php pages I need to link to and I also need a form action to link to another php page. I have tried the wordpress forum to no avail so forgive me posting here. I want the form action to go to the tiny page but it stays on the same page. I have no errors showing. My test code is <p>Test Tiny MCE link interview template</p> <?php $my_url=get_bloginfo('template_url').'/tiny.php'; echo $my_url; ?> <form method="post" action="<?php ('$my_url');?>"> <p> <textarea name="content" cols="50" rows="15">This is some content that will be editable with TinyMCE.</textarea> <input type="submit" value="Submit" /> <input type="hidden" name="submitted" value="TRUE"/> </p> </form> <p>Link to tiny test page</p> <?php $my_url=get_bloginfo('template_url').'/tiny.php'; echo $my_url; ?><br /> <a href="<?php ('$my_url');?>">Link to tiny</a>
  14. I am afraid that didnt work or the \. I tried 4/ and 5/ and 4\and5\. I have to break for the timebeing. Thank you so much for your help. If anything else occurs to u perhaps u could let me know in due coourse. rgds Lassie
  15. Still not loading. Is the fact that the link is in the page opened by the browser for the feed an issue?
  16. yes wordpress/wp-load.php is the file. Tried it locally and get the same error. I will update the server.
  17. Right I follow u. The url from the link is http://217.46.159.229/wordpress/wp-content/themes/custom1/detail.php?BookID=14 This is generated from the Feed link on the publisher page The feed url is feed://217.46.159.229/wordpress/wp-content/themes/custom1/ch9_exercises/generate_rss_06.php
  18. To Be clear the message I get with an absolute url is URL file-access is disabled in the server configuration.... I presume this is a security measure.
  19. The RSS generator file is below. I tried absolute path and it gives url file access denied in the server. I have the RSS files in a folder in the custom1 theme i am developing. The path is http://217.46.159.229/wordpress/wp-content/themes/custom1/ch9_exercises/generate_rss_06.php This is the message from clicking the link. Warning: require(../../wordpress/wp-load.php) [function.require]: failed to open stream: No such file or directory in W:\www\wordpress\wp-content\themes\custom1\detail.php on line 6 Fatal error: require() [function.require]: Failed opening required '../../wordpress/wp-load.php' (include_path='.;/usr/local/PHP/includes;/usr/local/PHP/pear;/home/admin/www/plugins/pear/PEAR') in W:\www\wordpress\wp-content\themes\custom1\detail.php on line 6 The generator file <?php require_once '../Pos/RssFeed.php'; require_once '../Pos/MysqlImprovedConnection.php'; require_once '../Pos/MysqlImprovedResult.php'; try { $xml = new Pos_RssFeed('localhost', 'root', 'root', 'ab'); $xml->setFeedTitle('Authorbank New Submissions'); $xml->setFeedLink('http://www.example.com/oop_news.xml'); $xml->setFeedDescription('New Authors and New writing for Publishers.'); $xml->setLastBuildDate(true); // $xml->setFilePath('oop_news.xml'); $xml->setItemTitle('WorkingTitle'); $xml->setItemDescription('BriefDescription'); $xml->setItemPubDate('updated'); $xml->setTable('book'); $xml->setItemLinkURL('http://localhost/wordpress/wp-content/themes/custom1/detail.php'); // $xml->setItemLink('url'); $result = $xml->generateXML(); if ($result) { header('Content-Type: text/xml'); echo $result; } else { echo 'Error'; } } catch (Exception $e) { echo $e->getMessage(); } ?>
  20. Sorry, I mean the file not found message. To be clear you need to go to the publisher page and click Feed. In safari or IE this will give a list. Read More is the link.Thanks also for your help
  21. AFRAID NOT. I HAVE PUT DETAILS PAGE UP SO U CAN SEE ERROR
  22. No, no errors. Just failed to open the path to the functions.
  23. I am developing a site based on wordpress. I have witten an RSS program that displays a list of recent uploads from authors. Each has a link back to a wordpress page that takes the book id and displays the details of the author and work. The problem is that when the link is clicked the wordpress page gives an error undefined function call (the first call is get_header() ). I thought the problem might be that the wp functions were not within scope, although all the folders and files are within the wordpress folder, so I put a line in to include the wp-load.php on the display details page. I cant get this to work though. The display page is as follows <?php /* Template Name: detail */ ?> <?php require('..../wordpress/wp-load.php');?> <?php get_header();?> <div id="leftnav"> <?php include(TEMPLATEPATH . '/sidebar1.php');?> <div id="right_pan"> </div> </div> <div id="rightnav"> <?php include (TEMPLATEPATH . '/sidebar3.php');?> </div> <div id="content"> <div class="roundedcornr_box_908360"> <div class="roundedcornr_top_908360"><div></div></div> <div class="roundedcornr_content_908360"> <p><img src="http://localhost/wordpress/wp-content/themes/custom1/images/video016.gif"/> New Author Submissions</p> <?php This is a link to a version on a server that doesnt have this display page but shows the link from the publisher page to show the RSS http://217.46.159.229/wordpress/ Any help appreciated.
×
×
  • 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.