Title: daverage's Replies - page 3 | WordPress.org

---

# daverage

  [  ](https://wordpress.org/support/users/daverage/)

 *   [Profile](https://wordpress.org/support/users/daverage/)
 *   [Topics Started](https://wordpress.org/support/users/daverage/topics/)
 *   [Replies Created](https://wordpress.org/support/users/daverage/replies/)
 *   [Reviews Written](https://wordpress.org/support/users/daverage/reviews/)
 *   [Topics Replied To](https://wordpress.org/support/users/daverage/replied-to/)
 *   [Engagements](https://wordpress.org/support/users/daverage/engagements/)
 *   [Favorites](https://wordpress.org/support/users/daverage/favorites/)

 Search replies:

## Forum Replies Created

Viewing 11 replies - 31 through 41 (of 41 total)

[←](https://wordpress.org/support/users/daverage/replies/page/2/?output_format=md)
[1](https://wordpress.org/support/users/daverage/replies/?output_format=md) [2](https://wordpress.org/support/users/daverage/replies/page/2/?output_format=md)
3

 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [wp_remote_get to upload image corrupts – local fiel alternative?](https://wordpress.org/support/topic/wp_remote_get-to-upload-image-corrupts-local-fiel-alternative/)
 *  Thread Starter [daverage](https://wordpress.org/support/users/daverage/)
 * (@daverage)
 * [12 years, 11 months ago](https://wordpress.org/support/topic/wp_remote_get-to-upload-image-corrupts-local-fiel-alternative/#post-3793168)
 * Hah, done it again – after hours of searching find the answer straight after 
   posting here!!
 *     ```
       function save_first_image(){
           	global $post, $posts;
           	$image_url = catch_that_image();
           	$post_id = $post -> post_id;
           	$upload_dir = wp_upload_dir();
           	$image_data = file_get_contents($image_url);
           	$filename = basename($image_url);
           	if(wp_mkdir_p($upload_dir['path']))
           		$file = $upload_dir['path'] . '/' . $filename;
           	else
           		$file = $upload_dir['basedir'] . '/' . $filename;
           	file_put_contents($file, $image_data);
   
           	$wp_filetype = wp_check_filetype($filename, null );
           	$attachment = array(
           		'post_mime_type' => $wp_filetype['type'],
           		'post_title' => sanitize_file_name($filename),
           		'post_content' => '',
           		'post_status' => 'inherit'
           	);
           	$attach_id = wp_insert_attachment( $attachment, $file, $post_id );
           	require_once(ABSPATH . 'wp-admin/includes/image.php');
           	$attach_data = wp_generate_attachment_metadata( $attach_id, $file );
           	wp_update_attachment_metadata( $attach_id, $attach_data );
   
           	set_post_thumbnail( $post_id, $attach_id );
           }
       ```
   
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [Looping through post_category and getting category names](https://wordpress.org/support/topic/looping-through-post_category-and-getting-category-names/)
 *  Thread Starter [daverage](https://wordpress.org/support/users/daverage/)
 * (@daverage)
 * [13 years, 5 months ago](https://wordpress.org/support/topic/looping-through-post_category-and-getting-category-names/#post-3291181)
 * Thank you!!! That worked first time!!!
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [Looping through post_category and getting category names](https://wordpress.org/support/topic/looping-through-post_category-and-getting-category-names/)
 *  Thread Starter [daverage](https://wordpress.org/support/users/daverage/)
 * (@daverage)
 * [13 years, 5 months ago](https://wordpress.org/support/topic/looping-through-post_category-and-getting-category-names/#post-3291170)
 * Thanks.
 * I get this
 * array(1) { [12]=> string(2) “12” }
 * Sorry, I am very new to PHP!!!
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[W3 Total Cache] [Plugin: W3 Total Cache] Defer JavaScript Parsing](https://wordpress.org/support/topic/plugin-w3-total-cache-defer-javascript-parsing/)
 *  [daverage](https://wordpress.org/support/users/daverage/)
 * (@daverage)
 * [13 years, 5 months ago](https://wordpress.org/support/topic/plugin-w3-total-cache-defer-javascript-parsing/page/2/#post-2508922)
 * Hi.
 * I was wondering if anyone ever got a copy of W3TC with javascript defer built
   in?
 * Thanks
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[WPtouch - Make your WordPress Website Mobile-Friendly] On / Off panel expands to cover most of screen when wptouch is switched off](https://wordpress.org/support/topic/on-off-panel-expands-to-cover-most-of-screen-when-wptouch-is-switched-off/)
 *  Thread Starter [daverage](https://wordpress.org/support/users/daverage/)
 * (@daverage)
 * [13 years, 5 months ago](https://wordpress.org/support/topic/on-off-panel-expands-to-cover-most-of-screen-when-wptouch-is-switched-off/#post-3253503)
 * Here is a link to an image of what is happening. As I say, before wp 3.5 it was
   fine.
 * I also have w3 total cache set to use a local CDN (if that makes a difference)
 * [http://marczewski.me.uk/photo.PNG](http://marczewski.me.uk/photo.PNG)
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[WPtouch - Make your WordPress Website Mobile-Friendly] On / Off panel expands to cover most of screen when wptouch is switched off](https://wordpress.org/support/topic/on-off-panel-expands-to-cover-most-of-screen-when-wptouch-is-switched-off/)
 *  Thread Starter [daverage](https://wordpress.org/support/users/daverage/)
 * (@daverage)
 * [13 years, 5 months ago](https://wordpress.org/support/topic/on-off-panel-expands-to-cover-most-of-screen-when-wptouch-is-switched-off/#post-3253501)
 * Don’t think pro is the answer. I have been using it for about 10 months and this
   has never been an issue.
 *   Forum: [Alpha/Beta/RC](https://wordpress.org/support/forum/alphabeta/)
    In 
   reply to: [Add Media and Featured Image buttons not working](https://wordpress.org/support/topic/add-media-and-featured-image-buttons-not-working/)
 *  Thread Starter [daverage](https://wordpress.org/support/users/daverage/)
 * (@daverage)
 * [13 years, 5 months ago](https://wordpress.org/support/topic/add-media-and-featured-image-buttons-not-working/#post-3232113)
 * No idea about suhosin. Work use a proxy with various over the top filters. As
   I say, 3.4.2 worked fine, just started with 3.5 🙁 as soon as I am no longer 
   in the proxy it works fine!!
 *   Forum: [Alpha/Beta/RC](https://wordpress.org/support/forum/alphabeta/)
    In 
   reply to: [Add Media and Featured Image buttons not working](https://wordpress.org/support/topic/add-media-and-featured-image-buttons-not-working/)
 *  Thread Starter [daverage](https://wordpress.org/support/users/daverage/)
 * (@daverage)
 * [13 years, 5 months ago](https://wordpress.org/support/topic/add-media-and-featured-image-buttons-not-working/#post-3232110)
 * Thanks. I have done that and refreshed caches etc. but no joy.
 * I have nailed it down further. When I load the page editor (for instance) and
   follow the network calls in chrome, I get told the following has a bad gateway(
   502) However, you can go straight to it!
 * [http://marczewski.me.uk/wp-admin/load-styles.php?c=0&dir=ltr&load=wp-jquery-ui-dialog&ver=3.5-RC4](http://marczewski.me.uk/wp-admin/load-styles.php?c=0&dir=ltr&load=wp-jquery-ui-dialog&ver=3.5-RC4)
 *   Forum: [Alpha/Beta/RC](https://wordpress.org/support/forum/alphabeta/)
    In 
   reply to: [Add Media and Featured Image buttons not working](https://wordpress.org/support/topic/add-media-and-featured-image-buttons-not-working/)
 *  Thread Starter [daverage](https://wordpress.org/support/users/daverage/)
 * (@daverage)
 * [13 years, 5 months ago](https://wordpress.org/support/topic/add-media-and-featured-image-buttons-not-working/#post-3232096)
 * I think it is a work firewall thing. I have a feeling we block cross domain scripting
   in some way. Same pc, same browser through our proxy and I get the error. Turn
   of proxy, tether to my phone and it works first time.
 * It isn’t the cdn as I totally switched that off and it definitely only started
   after the 3.5 install 🙁
 *   Forum: [Alpha/Beta/RC](https://wordpress.org/support/forum/alphabeta/)
    In 
   reply to: [Add Media and Featured Image buttons not working](https://wordpress.org/support/topic/add-media-and-featured-image-buttons-not-working/)
 *  Thread Starter [daverage](https://wordpress.org/support/users/daverage/)
 * (@daverage)
 * [13 years, 5 months ago](https://wordpress.org/support/topic/add-media-and-featured-image-buttons-not-working/#post-3232090)
 * Ok, gets a little strange now. I ran it from home and it works. Run it from work
   and I get the following
 * Uncaught TypeError: Cannot call method ‘replace’ of undefined load-scripts.php:
   407
 * The comes from // Underscore.js 1.4.1
 * The only thing that has changed of late (a big thing) is the fact I am now using
   w3 total cache to host files on a CDN subdomain.
 * So, I removed the JS files from the CDN and at work, still the same problem. 
   Is there something new that is doing some kind of cross domain call from javascript?
 * However, not sure why this would work from home and not at work – any help would
   be very appreciated!!
 *   Forum: [Alpha/Beta/RC](https://wordpress.org/support/forum/alphabeta/)
    In 
   reply to: [Add Media and Featured Image buttons not working](https://wordpress.org/support/topic/add-media-and-featured-image-buttons-not-working/)
 *  Thread Starter [daverage](https://wordpress.org/support/users/daverage/)
 * (@daverage)
 * [13 years, 5 months ago](https://wordpress.org/support/topic/add-media-and-featured-image-buttons-not-working/#post-3232041)
 * Seems to just be the images dialogue that wont popup. Was fine on 3,42

Viewing 11 replies - 31 through 41 (of 41 total)

[←](https://wordpress.org/support/users/daverage/replies/page/2/?output_format=md)
[1](https://wordpress.org/support/users/daverage/replies/?output_format=md) [2](https://wordpress.org/support/users/daverage/replies/page/2/?output_format=md)
3